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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 v  [4 J2 E/ V  W4 }, A# i
  1. [code]EDMA sample test application: l; {- e3 m6 X/ W8 ]& U. D5 g6 T
  2. /*, ]' b1 @: P4 O7 \1 S
  3. * edma_test.c
    1 G- k/ ^; |0 h. r* Y9 {
  4. *  ]2 E! z+ h* a/ Y* Q
  5. * brief  EDMA3 Test Application
    3 C- r& P. d$ W0 w
  6. *
    9 s8 {! X) O- R3 b
  7. *   This file contains EDMA3 Test code.7 o% ]1 Z% R- `! r) F
  8. *
    5 z1 L9 R, N9 G! ?3 S" Q: I! t8 e- J, e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 u, ~4 w! U, }* p3 o9 p) q9 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + w; Z. P8 S4 f( D, \
  11. *         TO CHANGE.
    - s0 g6 V4 J0 `8 M- a" `
  12. *' ^# H+ v/ S+ a3 P" E* K, d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- D5 S2 Q$ z: G
  14. *
    " k1 \' u; ~( X- s6 a
  15. * This program is free software; you can redistribute it and/or
    ( p! }1 `5 V* M4 @* W
  16. * modify it under the terms of the GNU General Public License as' m8 p; l- T0 |1 C
  17. * published by the Free Software Foundation version 2.
    ) S9 t  v) L6 z, f3 @, h) [
  18. *
    0 |' c* a8 s6 K3 J7 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 k- W( Y4 C1 F$ }3 D0 x
  20. * kind, whether express or implied; without even the implied warranty- h' f7 d' ]$ h! D6 W7 s1 S  x6 p0 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  [* T9 T& k6 ?1 a. I! h7 P4 S
  22. * GNU General Public License for more details.
    ; ~/ H' a8 A$ T/ V
  23. */
    & X- @8 T4 g2 J6 I  c) ~8 e
  24. % h1 X) o" [) m7 O* F4 @
  25. #include <linux/module.h>) J! [5 o: S6 v4 K: y; a: J5 P* q
  26. #include <linux/init.h>$ K: S. e% m  D' }
  27. #include <linux/errno.h>, V7 T4 Y+ k" \. |" w5 }" X
  28. #include <linux/types.h>" u/ M. W' q% Q4 z
  29. #include <linux/interrupt.h>1 g; M/ D5 G9 C' k
  30. #include <asm/io.h>  x" M2 z+ u. G
  31. #include <linux/moduleparam.h>/ U- U7 c2 v2 h+ D
  32. #include <linux/sysctl.h>
    ; H2 \) X2 ^2 k7 I. \! A
  33. #include <linux/mm.h>2 e4 W7 @! c  r, j# O
  34. #include <linux/dma-mapping.h>
    & n* w0 B7 r7 \6 @) y9 t

  35. - v# z: Z8 s* f, d( ?
  36. #include <mach/memory.h>
    0 J- a* {' W+ K# Z/ e1 p1 m
  37. #include <mach/hardware.h>" a6 y# b) S4 J% N: B2 n
  38. #include <mach/irqs.h>4 N$ q& U0 M2 W& _3 r
  39. #include <asm/hardware/edma.h>
    ' Z, k3 V5 x" C2 M, V$ ^( d0 A* s( Q

  40. - t) n+ ?8 Z2 f0 l# J
  41. #undef EDMA3_DEBUG; B+ W) ?  d, Y4 |5 K
  42. /*#define EDMA3_DEBUG*/
    / j, D* P" Z; Z
  43. , p, h3 V  E/ D: Z7 W. t
  44. #ifdef EDMA3_DEBUG2 F/ R* H" r/ @/ c$ ^! |% a- E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 s, J- ~% Z* G7 ]6 _4 @' h" k4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& o8 h" s7 ]; @0 _& C7 }  d& h* y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 l# l3 ?! I$ T+ R# |9 O
  48. #else
    4 R6 B1 G& t' V- i# G- ~
  49. #define DMA_PRINTK( x... )$ {( s9 q" |  G/ z9 Q$ |- r3 R
  50. #define DMA_FN_IN( o( e/ C7 ~+ Y
  51. #define DMA_FN_OUT# B' ]6 u; u& h) U
  52. #endif
    6 Y4 R7 U8 _: K) v3 v$ [# P; a
  53. 4 W" T- K* `7 ]3 g/ R' r; \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ U2 e1 V4 t: N1 i% R( }/ D9 {
  55. #define STATIC_SHIFT                3
    - ^) `: G! z& f7 X7 y& G7 w" \, N
  56. #define TCINTEN_SHIFT               203 L, D. x7 h2 X. E9 K, p
  57. #define ITCINTEN_SHIFT              21
    ) b* I& \7 x" a  l: C: a
  58. #define TCCHEN_SHIFT                22% n  G0 p* t) A4 b
  59. #define ITCCHEN_SHIFT               23: ]# w4 b- L0 n
  60. - `/ m0 A( H: E+ i8 b# {4 h! |5 g; B
  61. static volatile int irqraised1 = 0;
    & w& v# |& B% ^5 v) H- D
  62. static volatile int irqraised2 = 0;( A. ?6 g# Q* }% K" I
  63. , k% z5 w0 r1 O' c8 f) f7 h5 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 u, j# P$ a+ m- ^: s7 |: ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 l7 ]! _" H7 R* W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 W. q, T, R) B4 m" ~' B
  67. - [5 g0 D" o! ]& a2 J4 d  V
  68. dma_addr_t dmaphyssrc1 = 0;$ S2 l) H( b! [+ d
  69. dma_addr_t dmaphyssrc2 = 0;0 z& b2 A$ g+ n! r& U0 `6 q
  70. dma_addr_t dmaphysdest1 = 0;: N: W9 ^% ]( `9 |
  71. dma_addr_t dmaphysdest2 = 0;6 q4 `9 w- Y' I- V) ]; Y1 w

  72. ! B) ^4 m+ o1 ~0 g" K
  73. char *dmabufsrc1 = NULL;2 w# f8 k. F2 L( m/ n% W/ T
  74. char *dmabufsrc2 = NULL;
    , g3 I, q5 _! U2 O: z
  75. char *dmabufdest1 = NULL;4 g( Q- S/ k% w$ n8 K! y
  76. char *dmabufdest2 = NULL;
    " d& I! @, ]' C3 [+ Z
  77. # K% s: ]8 E/ X  h( f0 ~* K
  78. static int acnt = 512;
    9 g. e' v+ z6 I7 y! h
  79. static int bcnt = 8;
    ( {& N/ A% V, `. \1 d8 d
  80. static int ccnt = 8;; K" a" z2 N; J  ~# H5 M0 B

  81. # c/ o7 w+ H% r6 R
  82. module_param(acnt, int, S_IRUGO);7 Y% u! r, c7 H; w+ c( S6 t4 Z1 J
  83. module_param(bcnt, int, S_IRUGO);. L# }+ t3 b1 q. r* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; I6 i* @; D& u
7 p0 e( a3 J) e1 h, ], u; f- R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 u! z0 v2 M$ w5 _* v9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: Z% }- z  D  {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K- i! G. b: G+ ^. `* j1 ?  H0 ?
. d4 m+ p2 ?; I$ K6 N2 l5 X1 b. |# p7 C1 B0 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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