OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 K0 ?! n# M7 l7 |' S3 E! L
  1. [code]EDMA sample test application( g1 H2 ^3 R1 J( B
  2. /*) c- i/ w1 l& @# C9 L3 {9 C9 Y
  3. * edma_test.c
    - u+ p& s; o, U2 O& j
  4. *
    8 ?9 C1 }4 u  T5 o6 b
  5. * brief  EDMA3 Test Application- s4 W5 m0 p/ I9 m- E
  6. *3 m' e& }( `$ r" r: [8 ~
  7. *   This file contains EDMA3 Test code.1 H& x/ n' `/ M/ W+ x! {" i# x# ^
  8. *: |8 ^6 i, ~9 p( g" w$ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      J( Y1 V+ Y$ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) [" \+ _- D& P( n) \5 Y$ ~% i
  11. *         TO CHANGE.6 ~; p' c5 W0 `4 ]+ |
  12. *
    & {8 T, C6 z  |; A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % ~' u* p: }  o* N( V8 |
  14. *
    7 |; k6 @$ Q# i/ P8 ]3 J' G* u+ G
  15. * This program is free software; you can redistribute it and/or9 c- f2 c0 K0 Y8 r. r5 T  d
  16. * modify it under the terms of the GNU General Public License as
    % J$ f1 D1 i7 C& c1 N# ?
  17. * published by the Free Software Foundation version 2.
    6 R% i5 C2 F8 b3 B- ?! |& O8 @
  18. *& ]- Q, J; b& r; i+ {. s# u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / E& ?0 j1 v7 [! [
  20. * kind, whether express or implied; without even the implied warranty
    # s( ~. f$ V. c: a, B) d: B) o8 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 v7 t& @$ ^5 M7 U, I' o: ?- W1 O
  22. * GNU General Public License for more details./ r+ d0 ]' C7 x3 w: u7 a& K, f* H; L
  23. */, _8 Z9 |7 v0 `' x

  24. " I1 a) y" C; d! R& ^; F
  25. #include <linux/module.h>0 a/ {' ^9 ^# s+ d; ?
  26. #include <linux/init.h>
    , E$ J. ~8 t2 j5 d( _
  27. #include <linux/errno.h>  B& F: z, G5 E. F7 ^* _, y  q
  28. #include <linux/types.h>' K  r+ i6 F# z5 F$ [4 q
  29. #include <linux/interrupt.h>. b- p  ?0 H1 l9 B8 C$ {! _. u
  30. #include <asm/io.h>* O  M! _9 {9 i6 Q+ a$ w' l6 s% n
  31. #include <linux/moduleparam.h>
    , w! \8 F6 v1 V4 H, V5 F: u- Y0 m
  32. #include <linux/sysctl.h>/ w* n' V# K) D7 `
  33. #include <linux/mm.h>
    ' y" f) ^% S7 n* W  f. X7 J4 C
  34. #include <linux/dma-mapping.h>" f3 E' T3 z; c; R) k
  35. 2 I  L; n" ]# K, m1 {
  36. #include <mach/memory.h>
    9 d8 `9 K1 M5 F% u+ ?
  37. #include <mach/hardware.h>
    5 J7 r- I4 ?4 J2 y# Z$ z
  38. #include <mach/irqs.h>% O( y  q/ A2 y* {( T+ _
  39. #include <asm/hardware/edma.h>3 {7 @5 I8 _' V/ n2 ~6 C) \
  40. 9 t% J( V+ g' U& q5 a
  41. #undef EDMA3_DEBUG5 ~* L+ T: f7 n8 D# F
  42. /*#define EDMA3_DEBUG*/2 _1 o& e! g! K: A1 k) _, L, S

  43. ' R  g/ @, n5 A# y% Q1 y/ i
  44. #ifdef EDMA3_DEBUG- b! i. u" x+ N% Q& U! P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / n3 v; x  d* v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 o  ]% ^) G; U( a" Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Z6 P: H# L* z2 \2 \) B
  48. #else& w$ f1 D  Z9 |5 {
  49. #define DMA_PRINTK( x... )2 n0 Y. I5 i0 ~. @
  50. #define DMA_FN_IN4 M4 I0 W, w7 h. f+ f0 f
  51. #define DMA_FN_OUT
    / V7 m# s: J: n1 Q5 G
  52. #endif
    9 p$ ^. l) {! [' v+ o% g2 P: P# G
  53. / ^) s, x" _* x9 U9 H2 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" m) R7 n# t5 ~3 j1 w
  55. #define STATIC_SHIFT                3- |$ |2 c% M+ L6 H9 C
  56. #define TCINTEN_SHIFT               20
    . ~0 u- N/ M1 n7 I& {& _9 D5 {+ O- s
  57. #define ITCINTEN_SHIFT              21& ^. c- Y+ E, I4 ^( [
  58. #define TCCHEN_SHIFT                22
    & @  w. ^. n1 G0 c: U; `. Z/ Q
  59. #define ITCCHEN_SHIFT               235 j* x7 {+ b9 q; {2 y6 t3 V
  60. ) |9 p8 P; A  Q; ]# H/ R6 C" R
  61. static volatile int irqraised1 = 0;
    " {1 A3 i$ G( a  G3 T
  62. static volatile int irqraised2 = 0;( Q# A  j  E7 i3 u/ V9 w
  63. ( X: U! n% n6 D' i9 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N2 j" ?# x9 v9 p6 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O8 H) S/ t, A  s8 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * a$ {5 j  \! r
  67. 5 i/ g2 \/ v7 D0 u
  68. dma_addr_t dmaphyssrc1 = 0;0 y  |( o- b5 @* }
  69. dma_addr_t dmaphyssrc2 = 0;
    7 c$ |6 x" p2 I0 H6 A9 o
  70. dma_addr_t dmaphysdest1 = 0;
    2 D& q3 S8 e* b5 L
  71. dma_addr_t dmaphysdest2 = 0;
    + `1 ]$ Y; o0 {& h( ]6 v  o1 z
  72. 2 L( L: `$ w0 W& r. F" g
  73. char *dmabufsrc1 = NULL;
    & A, u8 m4 N2 B, q
  74. char *dmabufsrc2 = NULL;6 U' U8 _1 k# I" h
  75. char *dmabufdest1 = NULL;0 R) C+ c. S" D
  76. char *dmabufdest2 = NULL;
    * H& v' i8 r% d& S# G2 X- n

  77. & E6 _( s1 }7 c- u( T% |
  78. static int acnt = 512;
    % y0 z8 ?; z6 P9 H. m  A0 H$ s% b3 y& o
  79. static int bcnt = 8;
    0 t" L* ^1 T' q+ u' F
  80. static int ccnt = 8;
    . e( w2 u3 y' K% w  ^% U" [
  81. 6 s% Y- M" w. c, r2 z
  82. module_param(acnt, int, S_IRUGO);
    . h$ m3 _' X3 W  U/ J  Y8 w
  83. module_param(bcnt, int, S_IRUGO);7 m1 \7 |4 u1 E$ _9 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  k$ g& P! w" s/ w4 e

3 r: K* Q8 z& I/ X' y) d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) X# Z' U2 P! Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& n8 ^# h$ b# B$ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- w2 v0 h- L. K# j6 y2 y) e

) P8 p# H0 z1 ?" ^( B- N/ I! l' k( Q/ T& @- u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 17:09 , Processed in 0.046532 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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