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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K4 w$ {2 S" a. V/ }3 R, h
  1. [code]EDMA sample test application" x6 p0 X6 b" W* n. S- t8 s. Z
  2. /*+ u, `1 ?! V; b
  3. * edma_test.c
    $ N, c8 C1 Y$ [0 u- m
  4. *
    ! O! V$ e) X, k0 b6 ?2 k
  5. * brief  EDMA3 Test Application
    : N" g. g- q. l6 i0 ~# l
  6. ** _) g+ \: J& c+ V: L6 A: Y' u
  7. *   This file contains EDMA3 Test code.5 M" m: D$ H% C
  8. *$ ~1 R9 ]" I+ i( S0 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y: f$ Z- d3 ~, b8 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' e/ m& E  u( C
  11. *         TO CHANGE.# Z4 m  [* s) `/ I2 `
  12. *" Z0 H, |5 u7 T& _9 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 F$ k! F9 \0 s: S2 n% `
  14. *
    % _, j2 L# z( H: ?# V9 C) i) j9 h
  15. * This program is free software; you can redistribute it and/or
    ; b. P) z$ ?' l; z, h
  16. * modify it under the terms of the GNU General Public License as3 h1 R/ r- ]* L( E* x) U
  17. * published by the Free Software Foundation version 2.  J  C$ v+ J- {: a/ f) m
  18. *
    ; J& ^7 p6 D5 m% j9 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      |) V9 H& ?. k( G6 Q  s
  20. * kind, whether express or implied; without even the implied warranty
    7 @9 W$ j. e$ u& U1 S3 J: r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # s' X/ Q) k5 r. V8 g" H) ~( N0 K1 V
  22. * GNU General Public License for more details.) i; A- @/ [( Z, i
  23. */4 [* t1 ~/ b, b. q: ^1 }2 A3 T

  24. * ?0 }* P7 j- Y$ N6 |6 Y/ z
  25. #include <linux/module.h>
      ^8 k5 q8 g$ v) u* M
  26. #include <linux/init.h>
    - k/ h/ W$ e) c+ C( U5 R
  27. #include <linux/errno.h>4 `& \4 ~  @) p: x! G+ P% a
  28. #include <linux/types.h>
    ) v5 W+ B: H* F1 C- a- Q
  29. #include <linux/interrupt.h>/ P+ ]7 Q0 R& P0 g0 X
  30. #include <asm/io.h>% c' [( k* g- L) i. U
  31. #include <linux/moduleparam.h>4 A- X+ j! D; ^6 n8 Q2 D; \. Z
  32. #include <linux/sysctl.h># M# G" I  v9 R& ?6 n& g8 {
  33. #include <linux/mm.h>, M0 B  J2 _9 }; ^0 A
  34. #include <linux/dma-mapping.h>4 b7 D4 a2 A9 b5 `9 s
  35. 0 P" k' m- C$ Y7 T: p8 E$ x! L+ R# w, l
  36. #include <mach/memory.h>
    6 M) ?5 O- \8 s; }, W
  37. #include <mach/hardware.h>
    . A. [; p$ E7 L( @: N3 ^! L
  38. #include <mach/irqs.h>' [+ ]* p7 W4 r9 [: ^
  39. #include <asm/hardware/edma.h>, R" a. b  f; D3 z4 T- m4 A
  40. 4 M4 {+ X* t8 _
  41. #undef EDMA3_DEBUG
    & V. F+ z# u( k
  42. /*#define EDMA3_DEBUG*/
    ! p7 E! c% y$ ?$ M. y' D

  43. " G# I5 Y$ R) M$ `$ w* v  a
  44. #ifdef EDMA3_DEBUG; Q( R7 v) d/ }. @' L+ d* r4 J( |0 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 |# _% u4 K! w; O4 Z1 l- Y$ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * _# o' R; M, K; p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 Y# e) I  h- r4 v) {
  48. #else
    4 V4 r0 _1 v- S5 r: y7 l) \* q. i" u7 b
  49. #define DMA_PRINTK( x... )
    % j3 \$ t. S, R6 r5 y
  50. #define DMA_FN_IN) g6 @2 {" m; P/ I' L4 F" h2 }
  51. #define DMA_FN_OUT0 G4 ]+ R6 @% b$ J
  52. #endif0 k+ |) t7 ?! B

  53. % a  C; w6 B5 ?, i" G  X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : c: R; A' t( ~5 f. R6 w$ g
  55. #define STATIC_SHIFT                3" Z4 J2 b  b7 g) U
  56. #define TCINTEN_SHIFT               20
    # a0 W! v; W1 f% S* m
  57. #define ITCINTEN_SHIFT              21
    2 p& `( O/ R# J, w
  58. #define TCCHEN_SHIFT                22
    ) D% e$ q7 s% d3 A
  59. #define ITCCHEN_SHIFT               236 e1 V/ y5 R( L# M  u5 [6 \

  60. 7 p( a9 H  t  c# i' c' k! d, g1 k
  61. static volatile int irqraised1 = 0;
    : M2 j$ {3 x: y6 U! d+ T
  62. static volatile int irqraised2 = 0;
    : ?* d; L) b! v) ]' z$ J2 N7 Y
  63. 6 V* A% L3 R) p- q: |; O$ a$ j; a* x1 Q  a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / t! b- v  ~) r1 U* j2 b. V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z, J/ ~7 u# ?) U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " p1 d6 K( T( n
  67. - f! {4 k" @2 |1 T
  68. dma_addr_t dmaphyssrc1 = 0;
      ?2 p3 }& t2 F5 o
  69. dma_addr_t dmaphyssrc2 = 0;
    4 j' K  N. Y" V
  70. dma_addr_t dmaphysdest1 = 0;/ ?. c/ q5 B( [$ [! N: c
  71. dma_addr_t dmaphysdest2 = 0;
    1 z! A6 ?9 ~2 N9 b2 r  F

  72. " G- L' x+ V" N) m) y% h
  73. char *dmabufsrc1 = NULL;
    * x- U+ N& k" V9 E
  74. char *dmabufsrc2 = NULL;: V$ {0 V& k! h8 y- e
  75. char *dmabufdest1 = NULL;( G% T9 a0 O! D, e( E
  76. char *dmabufdest2 = NULL;$ b" |; j% N7 b3 T
  77.   f5 R) Y+ L$ }1 O! p
  78. static int acnt = 512;: n$ b' P6 ]  J' ~' d" e; h) f$ M( G# C
  79. static int bcnt = 8;' N, M2 f6 [( y6 {% ?4 k2 s
  80. static int ccnt = 8;: O: T1 Z/ Y; o8 Q
  81. 0 G7 v* p4 h* N1 A$ W' x
  82. module_param(acnt, int, S_IRUGO);
    * D) a4 j2 V/ ]" k5 e
  83. module_param(bcnt, int, S_IRUGO);
    ' M: J+ C9 U% C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ A* s! t& p1 b+ S, u/ C. k) c
! @; b" b9 b  U+ o1 C% G$ R% l, K$ P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 A/ A! t3 u& M, o0 A" A8 V; y* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* w: I+ A0 j4 M# H( R/ [* `# U5 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% U. m* {; ?4 O, [' ^
6 \, X) d% b- O/ j& s7 U8 o7 R3 l- K
* @! X2 u2 @# C. m0 }$ P6 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 14:14 , Processed in 0.039882 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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