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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, q* p) N7 f8 t6 r) `/ M7 |2 Q
  1. [code]EDMA sample test application
    0 Z) a1 M  z. @
  2. /*6 D6 A0 u" V5 ^- D8 R6 C! B
  3. * edma_test.c& i) G* b( m% d/ C2 w2 O, k7 [
  4. *
    % ]* k, b: K6 {
  5. * brief  EDMA3 Test Application
    ( V+ n/ Y3 ], E: Z
  6. *1 M3 u9 T' \0 R
  7. *   This file contains EDMA3 Test code.* U+ \5 R7 T4 L* H/ R5 C
  8. *+ X2 a7 x; L: [1 Z& @; }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + T2 ?- q4 C$ L. k  e1 j/ Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Y1 C" f9 }% M6 g* `' ]5 \1 j
  11. *         TO CHANGE.
    , h* S0 x+ L/ ]# g
  12. *# W* Y* `7 @( z3 t; r& a8 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! |& x; x* s) t: N, F) G& N# Z8 n
  14. *! y( `0 x# h1 M7 u9 A( |
  15. * This program is free software; you can redistribute it and/or" e0 _9 Y; H+ ?, d
  16. * modify it under the terms of the GNU General Public License as2 {$ N! h2 H9 @. s" w& H4 c
  17. * published by the Free Software Foundation version 2.
    . k! n8 |$ [; W7 [$ e& Q! f$ w
  18. *" I- C2 l9 \! x- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( \) Q1 N: \' ]; w
  20. * kind, whether express or implied; without even the implied warranty
    ( r5 @5 j; |! l( |0 {* g) W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 ]9 O( b7 f3 b% S  e' I' m
  22. * GNU General Public License for more details.1 B, x% z; ^1 R$ e8 j* L! e* _; k9 Z
  23. */% Y' W& O, O/ H8 {8 d3 |
  24. * {! B  ?8 N* G3 x- y5 Q
  25. #include <linux/module.h>
    4 ~( W. k  u# ]! N
  26. #include <linux/init.h>5 q. a- r3 E; x' T9 g% B. W
  27. #include <linux/errno.h>: i5 t7 y. g; r9 _0 p
  28. #include <linux/types.h>8 l2 ~/ x) }2 w7 d% j: _" t
  29. #include <linux/interrupt.h>
    / t+ Y' v" n, ]% o+ \
  30. #include <asm/io.h>4 P  ~% N% g" o; P5 N* ~
  31. #include <linux/moduleparam.h># o# i- `6 n, q# P, z* v* p- _
  32. #include <linux/sysctl.h>
      n- ]- ]* T' ^2 v* ^( C& R
  33. #include <linux/mm.h>0 r! O# r7 v5 F
  34. #include <linux/dma-mapping.h>
    ! H) d+ X7 Y& X1 {

  35. / i: H: O3 {8 p, q6 W5 U4 B
  36. #include <mach/memory.h>
    8 u: a+ {: M, `! G- [
  37. #include <mach/hardware.h>+ _2 B5 A0 Z0 [4 D
  38. #include <mach/irqs.h>
      b- p2 J. g! G2 H6 _' l
  39. #include <asm/hardware/edma.h>
    ' g; ?7 c  M  e, p% H; r$ t& ?
  40. / t+ E$ Y, q2 _& r$ p/ F5 ?
  41. #undef EDMA3_DEBUG9 B1 E9 D6 S: L
  42. /*#define EDMA3_DEBUG*/
    + z. i0 a0 U8 n
  43. & q3 G6 p# d. X% G0 H& |9 c
  44. #ifdef EDMA3_DEBUG% k, u- m& h, q- [8 w  Z& j5 g) b% j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Y; `" s" R2 s/ q9 K" N- s! P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i9 ~" m4 Y; H) [& z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 g& x2 r- L( \$ m
  48. #else8 f: e% X/ N4 }! B. g
  49. #define DMA_PRINTK( x... )
    ) s- S- a% q1 K* E& E/ q& i- B
  50. #define DMA_FN_IN
    " k9 d  Y9 }4 \2 \# J! ^9 |0 d5 T
  51. #define DMA_FN_OUT
    . z( }, @0 |' O+ }: H5 \
  52. #endif
    . d1 h7 x. Z4 v9 ~1 h

  53. % ]1 M' ^; k3 e" G$ |, p2 E$ S6 v6 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); b  V4 T) Z6 e
  55. #define STATIC_SHIFT                3
    / S. h* {- p, b+ v
  56. #define TCINTEN_SHIFT               209 b( `; B  n$ y  o) B4 G% A
  57. #define ITCINTEN_SHIFT              21& {& @3 Y: q: d( V0 Y0 f
  58. #define TCCHEN_SHIFT                22
    ( x. z. T  j8 ^( x" ^! L$ b& Q$ t
  59. #define ITCCHEN_SHIFT               23
    * j$ `/ _: h6 j) ~3 v& g" b% {

  60. 9 e! B' `8 K4 a7 F9 i
  61. static volatile int irqraised1 = 0;
    / ]# I2 v9 X! C& [0 J1 {. s# j1 \
  62. static volatile int irqraised2 = 0;
    0 m, p, o6 @+ v9 I# y3 e9 I' p  l

  63. 0 c2 w: H% ?& S4 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( t: R5 j9 t$ |) V4 ^2 S* \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M6 y  k  [  p6 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ~9 Z6 A" X! j' A  k+ S% Y, J

  67. ' o$ ?( u; s. O: `  ~) q
  68. dma_addr_t dmaphyssrc1 = 0;
    5 Y9 V- n8 L+ ?) a7 a$ u/ O
  69. dma_addr_t dmaphyssrc2 = 0;
    ! L* P6 E8 t0 K5 o$ {3 b5 r  D4 d
  70. dma_addr_t dmaphysdest1 = 0;4 @" k- s# y2 s0 X
  71. dma_addr_t dmaphysdest2 = 0;
    0 I7 V% k/ m1 [& {) [4 k! G
  72. % z" N5 ~- x4 Z# l% R8 ^
  73. char *dmabufsrc1 = NULL;
      }( ?$ H8 ^+ S' e9 V' M7 J
  74. char *dmabufsrc2 = NULL;* q. `* o4 |+ P7 H1 ?9 ]) Y- c
  75. char *dmabufdest1 = NULL;* m% J7 o1 @+ U8 L4 b: E
  76. char *dmabufdest2 = NULL;8 [) W/ [! }* G

  77. - p0 T: G2 T, v/ F$ Z% T
  78. static int acnt = 512;0 _: I# P# ~6 Z2 c
  79. static int bcnt = 8;
    & q7 S4 C2 V: E$ I, b
  80. static int ccnt = 8;* Z( n( g$ @" z4 u- H, N* l! a

  81. 1 P: }) ~( A7 e( ~8 y
  82. module_param(acnt, int, S_IRUGO);
    9 X) Q  w6 t: Q+ z( i7 b! ^) r
  83. module_param(bcnt, int, S_IRUGO);% K" _. X* `/ ?, |. L9 A' q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" g2 i" }7 ^; @
' e" t  j4 c0 \) s3 o9 A# ^# g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- \4 Z) w4 D+ C& B5 k5 {: @) Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( I$ J& m5 i; Q$ c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d4 b7 P! x7 Z+ d7 ]7 T. O' y1 A
" q5 x. B! Q, K4 z% q
7 X" ]; k' [/ `; i3 m; ~5 f1 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 13:50 , Processed in 0.039108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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