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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* p# F) U3 t9 I; R, H
  1. [code]EDMA sample test application
    0 B7 C  t  z. W) S
  2. /*' ~/ b; M7 ~& `/ i3 A' w
  3. * edma_test.c
    8 Y- {" o# y! e5 c6 z: M6 T
  4. *
    ; Q" B) J9 O# z2 V; ^  f! w
  5. * brief  EDMA3 Test Application7 J  p+ D1 k& K9 t- f2 e
  6. *) k6 x& w( u) }) D
  7. *   This file contains EDMA3 Test code., U; J3 ]0 R" X8 g. R3 S2 I
  8. *' h# i. m4 D+ R9 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 J  ?/ `$ n  o1 r5 @9 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' K2 i0 p2 A  ]! x
  11. *         TO CHANGE.
    1 y5 X9 Y1 d1 U( B
  12. *# D7 Y2 ~7 ]& `' E- F, y" c, D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ]! u$ n" C- \( T, b9 ]
  14. *
    1 h3 n; n# V7 M9 Q  E' `
  15. * This program is free software; you can redistribute it and/or- A8 ~& m3 ?' [. m8 ], q
  16. * modify it under the terms of the GNU General Public License as
    / |9 w/ P& f, Q7 y# s  d( P
  17. * published by the Free Software Foundation version 2.
    . ^7 [- H6 b1 C: w3 |" s
  18. *
    , D6 w4 n: V: p& [5 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - o9 @" S7 W' I* u
  20. * kind, whether express or implied; without even the implied warranty9 T3 J" `+ v2 P; |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 u% O9 F) M6 R7 Q' K: ^
  22. * GNU General Public License for more details.
    , ]# R. K' w9 }( Y6 d* \/ W" K' d
  23. */
    7 J/ X2 N0 v: a; s/ P0 q) G

  24. 0 F: {+ ^  t  c. {+ |
  25. #include <linux/module.h>
      j! q; ?! m- s; H5 U8 N. ?, r( S
  26. #include <linux/init.h>
    5 `  F8 G# |# @! ^4 w5 w: @8 l9 z
  27. #include <linux/errno.h>( |+ ^9 Z& x! @& m  @% L; q
  28. #include <linux/types.h>
    2 U, h9 Q" l; W* `, t9 F2 M
  29. #include <linux/interrupt.h>, ?6 n9 J0 {4 I( a
  30. #include <asm/io.h>
    + m: l; d, d3 u' W6 b9 v/ A" ?0 W  k
  31. #include <linux/moduleparam.h>7 D8 W8 r! t7 E! v( N& g+ b4 C2 H
  32. #include <linux/sysctl.h>; ]' Y! |$ i8 P
  33. #include <linux/mm.h>* T0 Z( Z# e4 ?/ S' o! K
  34. #include <linux/dma-mapping.h>5 `; J& i+ ]: B

  35. & ^, g% i. T9 i) O4 V
  36. #include <mach/memory.h>: @7 U& @6 e, s+ a( L) U
  37. #include <mach/hardware.h>0 Z! a3 f; w2 P# l7 X
  38. #include <mach/irqs.h>
    / r% {  S4 p# [5 R- Q
  39. #include <asm/hardware/edma.h>
    9 W* X7 U' n& Q8 @  S& w4 v+ Z8 S
  40. : o+ k/ }- F# p' q% X8 _
  41. #undef EDMA3_DEBUG, D* u4 E5 y6 y  w) _  ?" _
  42. /*#define EDMA3_DEBUG*/
    5 m, Q! `: m% a7 t- p/ U+ ]

  43. 2 A! o3 H) Y3 C
  44. #ifdef EDMA3_DEBUG
    6 k$ D, S: l8 U! k) r3 \  R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ F2 V7 `' \/ F8 d  [2 r1 R, t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 Q. k) K0 e3 t0 J, B5 u2 w- ^$ e) ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! F+ d% l5 _8 n6 R1 j
  48. #else4 t! s$ \" r8 t! q2 t
  49. #define DMA_PRINTK( x... )
    # d- N% e2 f8 w* b8 h  f8 q4 `
  50. #define DMA_FN_IN
    + q0 D& i% g! V: O+ F8 ]% Y
  51. #define DMA_FN_OUT/ R2 f+ `. q' u/ X1 K
  52. #endif/ l" \+ R9 }6 H! {. L4 k: H/ A

  53. # R2 y! a; v* Z+ u/ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 w# y# m' m. S" B# A; ^* b
  55. #define STATIC_SHIFT                3
    ; ?2 e2 U2 [, g8 F/ p: a
  56. #define TCINTEN_SHIFT               202 Q# t) j+ z/ N! f* q  Z1 k
  57. #define ITCINTEN_SHIFT              21! _0 Y2 {/ S- t
  58. #define TCCHEN_SHIFT                22
    9 r% u0 {+ @& p. f) a7 U# v4 r
  59. #define ITCCHEN_SHIFT               230 Z* r6 f$ a" }
  60. ; P& x9 R; G' {; X
  61. static volatile int irqraised1 = 0;
    - Y. t3 h" h, I! }
  62. static volatile int irqraised2 = 0;/ O; z5 q+ _2 p6 @5 `
  63. 5 }. u7 i+ P9 p$ h" `$ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  C! E: I# i4 {0 Z+ r# K( a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . h, j* u$ ]  N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( [$ O; N. e+ j2 W: R# {
  67. 8 f8 P" E2 N, E0 J- s, l' t) k
  68. dma_addr_t dmaphyssrc1 = 0;0 M7 |$ H; D; Z$ j, j9 n* @
  69. dma_addr_t dmaphyssrc2 = 0;( ^0 w7 ~, y2 U/ w, K# @, C
  70. dma_addr_t dmaphysdest1 = 0;3 t6 v# h6 b0 T9 p# h8 A" V' }  x, X
  71. dma_addr_t dmaphysdest2 = 0;- y+ k- `" B" P) ^
  72. & p+ y$ p- a$ ], I9 w, \
  73. char *dmabufsrc1 = NULL;
    5 W0 Y2 a# g- I; ?5 s- J
  74. char *dmabufsrc2 = NULL;
    ' x1 V: q) l$ j
  75. char *dmabufdest1 = NULL;
    4 H# ?( o6 r, u+ u- Q) W; a, ~( a
  76. char *dmabufdest2 = NULL;% A) y2 r" K1 b

  77. 2 m" _" Y( O) ]5 [9 L
  78. static int acnt = 512;8 ]; C2 ^& N- h% m; S; I# o/ m" f
  79. static int bcnt = 8;$ @; l$ O- _: p6 q
  80. static int ccnt = 8;
    , P* {' @6 ]) s( m1 f
  81. ! y  T5 p. q4 t, ]
  82. module_param(acnt, int, S_IRUGO);' F2 y  ~3 Z& t/ u
  83. module_param(bcnt, int, S_IRUGO);: H4 Q; R& q! P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ A; T3 l; {, B$ V5 ?" j: e$ S5 j% d; u: B/ }6 E) u6 G+ m& P" {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 L6 R8 h7 n" V$ t$ X- Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# j2 [& N6 C" M- I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 S& s! D9 B, D( i) e  \2 }

2 a& L' \( S( s8 @. s
$ {3 f8 A8 ]! j( T- q" r& u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 13:11 , Processed in 0.040625 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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