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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' `% `/ m/ G* G, U+ _3 K6 G. F
  1. [code]EDMA sample test application. Y/ ]8 i5 x6 c
  2. /*  D7 d5 |3 [$ |5 n9 T2 Z
  3. * edma_test.c
    * f. A  K2 f$ h0 o/ U
  4. *
      i, _1 N1 T" C8 {+ i
  5. * brief  EDMA3 Test Application: M  H9 J+ e5 A* K
  6. ** `! A  M0 P. i7 z6 s
  7. *   This file contains EDMA3 Test code.8 l4 X- g* T4 ^; ]
  8. *) d7 `( Y8 o: C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 F/ W. L/ }+ w8 _3 g, A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . B/ c9 U4 {' E$ R3 {' v
  11. *         TO CHANGE.5 ^. y5 m' E+ S/ v
  12. *
    ) Q/ i  _9 v) m; H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , j2 y7 `* j, m5 ^, p, o0 c9 G0 R
  14. *
    5 Q. O3 V9 S7 n" h% [! v% L4 f
  15. * This program is free software; you can redistribute it and/or
    / G/ n& [# y: ^% t7 p
  16. * modify it under the terms of the GNU General Public License as% ^, P( X: t0 u* o
  17. * published by the Free Software Foundation version 2.3 A7 w; w: y  |. c# L
  18. *1 @# u& s: }' k0 ~, D$ G( {0 n$ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 {& s% R+ v. o! k% e0 N8 O
  20. * kind, whether express or implied; without even the implied warranty7 c: d- C" z7 P( s6 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 `: ?  m  l  Q- s0 s$ N& H( y, {
  22. * GNU General Public License for more details.
    5 q) k7 r) \/ g2 |& y7 a
  23. */. K# t) i/ `6 Z# j4 b
  24.   G# m( f3 ]9 a9 [
  25. #include <linux/module.h>
    # f1 B1 D% d+ p! j# x
  26. #include <linux/init.h>3 s3 X4 V/ D& N, \/ m
  27. #include <linux/errno.h>" ]# e8 U+ T! j- T! W
  28. #include <linux/types.h>- ~0 H. O* _* L, Y% _7 f
  29. #include <linux/interrupt.h>2 K2 D) O- S! _8 Z: D. v
  30. #include <asm/io.h>
    . S/ o6 a! b0 Y# r) j* h
  31. #include <linux/moduleparam.h>! t# i3 @+ B( w& s( O
  32. #include <linux/sysctl.h>. C. a) x; v; t1 b& U3 B
  33. #include <linux/mm.h>1 s5 Y% g# P% _/ T+ F! v  V" A
  34. #include <linux/dma-mapping.h>+ C# L& Q5 G2 N+ V5 {) t# M

  35. - O. [. [* r7 d8 x
  36. #include <mach/memory.h>6 m/ ^, s+ {7 _5 E& n
  37. #include <mach/hardware.h>
    8 k/ h. F% w7 O0 A2 E) M
  38. #include <mach/irqs.h>8 |$ x! o- U: c9 s; i6 O) c( f
  39. #include <asm/hardware/edma.h>! g* u" }  K2 ~3 H% ~

  40. 6 `" |; f9 U, J( n7 t- F
  41. #undef EDMA3_DEBUG
    & B5 o& ^- C' w' `$ M/ P
  42. /*#define EDMA3_DEBUG*/! P0 y) ~  ^" @+ [3 J
  43. 2 {. q# Z$ }( Z9 @8 z; k
  44. #ifdef EDMA3_DEBUG
    8 z7 h$ T+ P% y1 M! o9 A& T! r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B" Y" r5 N/ z  `! P& @3 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% p7 @# J; \, n  C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 m1 c( p" V; q" P
  48. #else" I" K8 F/ i! s0 [+ m4 q" i. e% u
  49. #define DMA_PRINTK( x... )
    1 g. e% @% N, W2 o9 [, ~
  50. #define DMA_FN_IN
    . j* [% u/ [# j5 Z$ f" @
  51. #define DMA_FN_OUT' y# q6 x0 Z& u' g! o: e# \% E9 J. p
  52. #endif
    5 r% P) ^( s. v; x! V/ h

  53. ! T" J& h$ \, B0 d  X) P) L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% D: R/ R* |2 q  X% v
  55. #define STATIC_SHIFT                3
    7 H: s7 j" K  ?/ W9 s
  56. #define TCINTEN_SHIFT               20
    0 e' X  l& V' `* q- Z4 Z
  57. #define ITCINTEN_SHIFT              214 b) m' d0 K) c
  58. #define TCCHEN_SHIFT                22
    4 ]' ^6 b# ~4 Y# l. P5 q5 J
  59. #define ITCCHEN_SHIFT               23
    0 L! q0 n4 x( g1 P
  60. 9 g' _2 j. ~5 V+ t6 M
  61. static volatile int irqraised1 = 0;4 C* u! @  v0 c! s3 ]$ M
  62. static volatile int irqraised2 = 0;
    5 T4 l; A1 G) C/ L& m" c8 P* u6 F

  63. * f1 A% Z9 ]8 _! B. O9 W2 \( D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a0 t9 j6 E: A0 K! n0 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; x+ c5 d8 G4 x' G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 G" K3 N. G2 m  V& r6 s5 E8 U
  67. 3 m4 w( ]1 ~9 s8 D, _" }. z
  68. dma_addr_t dmaphyssrc1 = 0;) E9 M, U& H2 t
  69. dma_addr_t dmaphyssrc2 = 0;
    . {' {! K; w9 I( q& |
  70. dma_addr_t dmaphysdest1 = 0;
    ( `) m7 n4 o4 z8 d
  71. dma_addr_t dmaphysdest2 = 0;
    ; b3 z4 S! {! R7 A  E1 v; U
  72. & K/ ?( ?* b8 A! k" J8 K7 l! g5 I
  73. char *dmabufsrc1 = NULL;: h& B3 J' A; B7 u
  74. char *dmabufsrc2 = NULL;
    ( k# x- c. A: P1 H, B
  75. char *dmabufdest1 = NULL;( [: C/ `: a& \$ [& t; g) P- l
  76. char *dmabufdest2 = NULL;. U  r2 v0 v; e1 u) v6 H# ]
  77. 9 L( @0 K* C0 C6 m2 t
  78. static int acnt = 512;
    3 L$ e1 }* i+ g0 w
  79. static int bcnt = 8;
    ) W, E5 I( K. z+ Y3 M* ?' u6 E
  80. static int ccnt = 8;% Z! S7 |& l& Y! ]
  81. * Z1 h+ B( U! l( m4 m3 t0 T) O* d4 C
  82. module_param(acnt, int, S_IRUGO);; f$ N: ^- z5 Y5 z0 W$ G
  83. module_param(bcnt, int, S_IRUGO);
    ; z: _' B6 e/ a5 U5 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ S- ?" @; f9 I  B" `, B
7 d! I' c1 K0 K5 A! _, P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 o& S, g) O" w! N. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 l$ L' Q: V& U; B" N; l! p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: N! _9 a8 h! d5 g( W; X) }
# ^1 L) \1 }: z: ?( n& G/ e' w( D% w6 Z8 V% }/ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 21:36 , Processed in 0.039953 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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