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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% J5 `- @# d- g+ X  x
  1. [code]EDMA sample test application3 q2 V1 W; r- w& b3 s0 @1 _
  2. /*
    8 a2 @, l. o  ^9 H0 A+ w  O
  3. * edma_test.c
    + M+ Z% \7 D2 n3 L
  4. *7 B5 Q" O$ |* N
  5. * brief  EDMA3 Test Application
    : n* S! C, x7 z
  6. *
    6 O& M7 h- d  ]" r
  7. *   This file contains EDMA3 Test code.
    - M; A" n: c, [4 `, j7 [
  8. *
    # k- }' f' H: x) {: U; W: |( C9 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 B0 b/ l- v+ ?3 |( a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ m! b1 O4 _  y  @4 b
  11. *         TO CHANGE.( `3 Q' ~3 `7 @7 }$ [  i6 Y9 L. n
  12. *7 e0 @* B5 s. B/ J) N0 a! P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / c/ ^" m; X- x  S
  14. *  }. S- c9 w5 z' g+ p& n
  15. * This program is free software; you can redistribute it and/or9 b9 C; \/ `+ X" b' Z& r
  16. * modify it under the terms of the GNU General Public License as5 m# S- U; H1 c% Z1 J
  17. * published by the Free Software Foundation version 2.& a$ B* s- p8 E6 K/ d
  18. *! Z6 u" `: L( ~4 {# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " j+ L/ w% Q3 Z% D
  20. * kind, whether express or implied; without even the implied warranty- l4 |2 c! H8 w, T8 D- d) }5 _( Z: y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  o; m3 Y$ u1 z8 O  I! }( V
  22. * GNU General Public License for more details.
    0 |9 ~' X$ j  B+ A; P& u
  23. */" u/ K. a0 w3 D4 S8 K
  24. , C8 _* o9 ~* t: h8 S( k$ x; A  e
  25. #include <linux/module.h>
    0 ?* u2 @; j0 f8 b
  26. #include <linux/init.h>
    4 f8 {  R4 h0 h
  27. #include <linux/errno.h>7 Q: Z* |$ V+ J* H7 |$ [6 `
  28. #include <linux/types.h>
    $ H* y& S. X: }
  29. #include <linux/interrupt.h>3 Y! L$ g! [  t: T' v' ^8 v
  30. #include <asm/io.h>- p+ b/ ]* ?% g4 i7 q4 @1 k
  31. #include <linux/moduleparam.h>
    0 Q! X" b; r, Z, L; w% }- g
  32. #include <linux/sysctl.h>* @4 N) S# J) W' c1 u
  33. #include <linux/mm.h>" H1 N: Q  O7 W) d
  34. #include <linux/dma-mapping.h>; O4 i7 Z" W( i0 D3 Q

  35. 6 |$ B( `& ~+ f  p( S4 ]% T
  36. #include <mach/memory.h>1 k. \% A. R  j
  37. #include <mach/hardware.h>, g( F% n( E+ q" [$ J" Q9 [/ |
  38. #include <mach/irqs.h>
    & F% r# ~4 a: G# s" `# k% b
  39. #include <asm/hardware/edma.h>
    , ]9 Y5 L2 w* s4 b7 B4 G" k4 q- D

  40. 7 H) f. b5 w+ r4 j2 d( s
  41. #undef EDMA3_DEBUG
    9 U$ F: O3 g2 t
  42. /*#define EDMA3_DEBUG*/
    ' P9 o3 Z' s9 O! ^7 ~
  43. ! I: y- F3 S9 M7 B2 z. i" n
  44. #ifdef EDMA3_DEBUG
    1 ^4 l0 n+ i) k) R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ T; z4 }/ w) Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( X- C; r" B+ A5 k9 c' P! l( |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); p- F+ n, L3 {8 p
  48. #else* X+ E- O; f6 j5 i
  49. #define DMA_PRINTK( x... )
    8 O" N& r& n5 _* Y( V+ h
  50. #define DMA_FN_IN
    6 x& e* Q) u. S! e$ f
  51. #define DMA_FN_OUT
    . y' a8 q$ a8 o/ M$ _4 F' d' r7 e
  52. #endif
    & {8 D  o% t9 d, x7 I; m4 o' L! m
  53. " g- ?- i- k$ L7 M6 |8 N) u$ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! W; I5 R% Z  m3 q
  55. #define STATIC_SHIFT                39 J9 F! m: W( r3 O' B' C
  56. #define TCINTEN_SHIFT               20) Z* H# {4 `. F- Y( U
  57. #define ITCINTEN_SHIFT              21, k- n9 ~% P% m8 ?1 o6 o% o
  58. #define TCCHEN_SHIFT                22- I; e. K9 m; b: V, b
  59. #define ITCCHEN_SHIFT               23
      R2 B; G& D. J; i2 W

  60. ; j4 x/ Z6 I, {& |9 a! q5 v# T
  61. static volatile int irqraised1 = 0;1 g" [9 G1 X( D1 R( Y" _% S1 O
  62. static volatile int irqraised2 = 0;! P* N9 G" [$ ~& \. i  k4 M) F. {
  63. 9 J( u# b8 E% ~8 W, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) L2 B- o& Z: P; Y0 Q/ W5 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 W/ L9 V( L; b7 d$ f) q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q" K3 ^$ I' U+ E

  67. / e5 u. m( `5 B) B( [6 l, h
  68. dma_addr_t dmaphyssrc1 = 0;! W4 ]8 D* E5 ^0 J9 z" t6 @
  69. dma_addr_t dmaphyssrc2 = 0;
    6 o8 y* N- p& C8 L6 u
  70. dma_addr_t dmaphysdest1 = 0;$ |& G5 X$ W/ C" _
  71. dma_addr_t dmaphysdest2 = 0;, u8 s* h" y! r" k. l0 ^# i5 I; T
  72. 7 c' }' X1 \5 \& c0 }# B; Q
  73. char *dmabufsrc1 = NULL;4 Q7 p7 J6 G/ ]8 @4 e" S& M
  74. char *dmabufsrc2 = NULL;$ j* V2 q: k/ w$ [4 R9 u  j
  75. char *dmabufdest1 = NULL;
    6 K  R4 |2 _8 u/ P8 h3 A2 K% T) V/ d
  76. char *dmabufdest2 = NULL;; m/ `& Y2 ^5 d

  77. 0 U% j- w8 `/ a% \/ D  l
  78. static int acnt = 512;
    9 w( |4 K' P" g/ \  S6 r
  79. static int bcnt = 8;
    3 L! V$ t0 x& K6 U/ g$ M: d
  80. static int ccnt = 8;4 q3 J0 ^3 c/ t2 j1 }; A
  81. 7 `' V3 n# e5 _3 D# ]
  82. module_param(acnt, int, S_IRUGO);3 T0 x% [, F6 s1 @  b! U* F( I
  83. module_param(bcnt, int, S_IRUGO);
    " {4 d4 r3 D* z5 H& ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& j' d  C4 d5 C
0 ~% c' g) T+ T/ D4 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ M: x4 t: Y+ @* a& C/ n' J, qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 q6 x5 L2 F  [5 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: P% o. n5 R, g$ \) Z

( R1 t/ {5 y9 Z& c4 i5 M* C
+ Y8 s# T" D. U) v/ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 17:49 , Processed in 0.045928 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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