OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13115|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q2 C% v* A" X( k: \. n
  1. [code]EDMA sample test application
    7 d( y& z# J$ u: G+ k. o5 F
  2. /*
    7 C$ |- I4 l: R6 _
  3. * edma_test.c
    8 k" S" ^( i* K, P9 H' r
  4. *! ^( v" R# y5 ^  m
  5. * brief  EDMA3 Test Application
    ; v) \* x+ H9 L
  6. *0 Z. G6 l+ y. v/ Q% Z
  7. *   This file contains EDMA3 Test code.
    $ Y7 l. i7 i7 u' }
  8. *" X" n  C9 a- ~6 r9 V" m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ U8 e2 V6 o5 h; X. g% @/ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( J& R7 b6 n- Z: n. v4 A
  11. *         TO CHANGE.5 {3 @( ?3 Y0 m3 U6 U0 F) @
  12. *
    8 d" \% i4 U6 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " u4 H9 N( a) A9 N8 i
  14. *
    ! H/ b$ z  q" l" ?7 l, r- J
  15. * This program is free software; you can redistribute it and/or
    4 v- b0 p4 \* K- Q# v
  16. * modify it under the terms of the GNU General Public License as
    9 q$ z  E6 `5 E% Z  e3 B0 i
  17. * published by the Free Software Foundation version 2.
    0 [$ j- ^: `% {& l; c% S% Y/ s% r- X
  18. *
    3 U) o5 A: @, i. i# x' u8 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* s4 m* Q  u$ s+ O& j) q3 L% R. s
  20. * kind, whether express or implied; without even the implied warranty
    3 _# J* s9 J1 m8 t# O- C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- X, P8 c4 v, j" z
  22. * GNU General Public License for more details.2 ?( L6 n9 J$ [( q. K2 P
  23. */
    & L3 f; r% [  r+ J1 t

  24. ; V5 ?, a5 p- T5 W$ I2 `) a' j$ n
  25. #include <linux/module.h>
      `; t1 e1 P5 h/ W
  26. #include <linux/init.h>
    / T' A0 a; a0 N; T5 Y8 X1 M. _/ c
  27. #include <linux/errno.h>6 b/ I) P& v$ Z2 ?8 S* T. i
  28. #include <linux/types.h>
      |- t1 {2 q; A' N( q3 v/ T
  29. #include <linux/interrupt.h>
    2 z2 B  e' d* T
  30. #include <asm/io.h>
    5 ]: H7 {; [+ |' w* l0 E" J( C
  31. #include <linux/moduleparam.h>, n3 M4 _2 j; g/ H
  32. #include <linux/sysctl.h>% C4 R1 I  F( G& c) x  {
  33. #include <linux/mm.h>
    , p% B. t: s- b/ j1 K5 t
  34. #include <linux/dma-mapping.h>
      G) g% j: P2 G) J8 ]
  35. 0 a/ b, [/ M/ ?* c. z0 t2 t& l
  36. #include <mach/memory.h>
    2 E0 A  ]) E# x8 u8 A
  37. #include <mach/hardware.h>
    8 U3 n  }' ?, @9 C0 L* d
  38. #include <mach/irqs.h>- T# v! J* U6 }7 _  a
  39. #include <asm/hardware/edma.h>
    3 [1 z. y- H- [! E) Q$ h8 c0 d( P

  40. ( q& a! N6 Q# C9 K! @0 Z
  41. #undef EDMA3_DEBUG
    ' m6 I! k4 K' Z8 o7 g3 ]
  42. /*#define EDMA3_DEBUG*/9 f& {& H  H# M9 P
  43. : b3 u- H+ T0 t, ~
  44. #ifdef EDMA3_DEBUG* }: B6 e; T+ s5 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " G0 @- b' Q+ I) s5 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - D8 m9 C, t6 `5 U) d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 a+ l# N3 H* r5 v4 d! ]- A/ n' v  }
  48. #else
    5 S7 G7 o. U- R
  49. #define DMA_PRINTK( x... )0 G( E2 S# q+ r) i
  50. #define DMA_FN_IN, M  D7 ~7 w4 t- I$ k
  51. #define DMA_FN_OUT' Y4 s4 W0 I8 j3 J/ @: O) q; N+ D
  52. #endif- p, _( K/ m  T( y
  53. & l+ |; ?6 [. f0 ^' a9 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ?/ v0 X+ T4 n: V7 Y; v
  55. #define STATIC_SHIFT                3
    1 ~" F0 n3 o9 Z& O0 p5 H2 ^
  56. #define TCINTEN_SHIFT               20
    * m. r  \3 }/ l' Y
  57. #define ITCINTEN_SHIFT              21% q! h; C+ v! }% U) @
  58. #define TCCHEN_SHIFT                22- h; `, F9 g$ q4 T) F
  59. #define ITCCHEN_SHIFT               23, e7 |1 d4 s% G* Y" e" C$ q

  60. 7 y; ], m2 j# l0 }: _# {! E
  61. static volatile int irqraised1 = 0;
    + y0 ?( D! O/ A1 J! b, E! K
  62. static volatile int irqraised2 = 0;
    . e# u/ t% d1 m- d! ~
  63. 5 y2 W0 t: ~3 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 h; x$ P7 e9 M# p: O2 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 l5 E8 k. }9 x0 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 b/ X' e/ E* w
  67. 9 _2 ^& m8 |, B7 V8 w+ J- x3 P
  68. dma_addr_t dmaphyssrc1 = 0;. |7 M2 G" W  z, P: \/ [0 x. ]
  69. dma_addr_t dmaphyssrc2 = 0;) q. J8 K3 n5 Z2 L2 r) w' L
  70. dma_addr_t dmaphysdest1 = 0;
    7 }; ]) W# ?/ G
  71. dma_addr_t dmaphysdest2 = 0;' _) _2 Q' c1 ~+ i% h$ ?

  72. 4 u7 G7 e' D  E8 m
  73. char *dmabufsrc1 = NULL;' {2 @' H* r, m0 `3 M
  74. char *dmabufsrc2 = NULL;; M; q: o% c( R2 B" r
  75. char *dmabufdest1 = NULL;3 l. c, p# }. G
  76. char *dmabufdest2 = NULL;/ o6 v& ]  K" f2 ?) j
  77. - ]; [  X) p6 ~/ F& T, }
  78. static int acnt = 512;
    - `3 J0 Z# G* r: k# Y0 k
  79. static int bcnt = 8;
    ; N5 @! J- P2 b8 E8 C* ?2 ~. w
  80. static int ccnt = 8;
    * H, n5 u3 f. Y; h$ u2 Z

  81. ) |9 R$ g7 s' Z  ~/ E0 G6 }2 v
  82. module_param(acnt, int, S_IRUGO);% F( O' J! t' }+ P3 y
  83. module_param(bcnt, int, S_IRUGO);
    7 X, |' z- `7 D0 ^6 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- B+ m: e+ M* r! G6 ?7 ^; X

% K* d8 Y: p! c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 v. B- T7 D( b' V+ G
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, D2 h/ W# Y# T1 w% M- H$ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h" O# V* t1 s

% L; L8 E9 L& `( C, U
/ b8 ?7 V1 P) _6 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-4-2 22:24 , Processed in 0.039118 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表