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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 I( l* S4 i) D. i* h
  1. [code]EDMA sample test application
    6 h7 `1 S1 A3 P' M8 X, C% W
  2. /*0 ~9 s; K* G4 S
  3. * edma_test.c
    0 a7 h+ u  e9 {
  4. *
    ; T# P( \1 E5 P' m) H, R
  5. * brief  EDMA3 Test Application
    * O3 ]+ |  ^4 C5 F- L5 y
  6. *" w' E% d: Q' o( `8 u6 ]
  7. *   This file contains EDMA3 Test code., P( G. v$ l: D, ?' s( N$ C9 n
  8. *
    * J9 h1 t( Z8 q1 l9 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V. w( l% K5 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 ?4 f4 S8 A0 s: ^8 G
  11. *         TO CHANGE.0 v* }/ H, m( B7 @6 }4 \- w& i
  12. *' c) q6 C/ G6 M$ a0 Y# \3 ^% ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 i' }& f4 F' h% q
  14. *
    7 P" C1 ~: G$ O7 _: o% T6 \
  15. * This program is free software; you can redistribute it and/or
    ; ]$ |. r/ y1 V4 v4 f% n
  16. * modify it under the terms of the GNU General Public License as
    8 a5 ?( A# B) J' p' J8 F
  17. * published by the Free Software Foundation version 2.1 b% ~5 U$ V, ^4 o5 ?" v# R. E* ^
  18. *9 Z0 L; g2 w! G+ b7 K1 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F. h/ ^( d8 N- \+ T& s
  20. * kind, whether express or implied; without even the implied warranty3 N4 g! S' A5 }% A+ n. o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 }3 ~5 l, f4 H, m- s6 @$ t  l: S; r
  22. * GNU General Public License for more details.  m, T/ A/ a( c' n- v
  23. */
    ) W+ J2 a, b- F% J
  24. & D8 \* r; B8 q% r. I
  25. #include <linux/module.h>4 A- m. Q. `/ @8 _
  26. #include <linux/init.h>0 J- U% P: z: ]$ Y# D
  27. #include <linux/errno.h>+ G4 @' S6 p5 \( n" W8 w6 G
  28. #include <linux/types.h>/ J! U$ K/ |% b* o
  29. #include <linux/interrupt.h>3 v/ q: k" C; p3 w7 c# _
  30. #include <asm/io.h>& m' s8 R+ J; E% L
  31. #include <linux/moduleparam.h>
    9 C3 L1 Q( R6 J& X% k% B
  32. #include <linux/sysctl.h>* @7 p+ V: p+ q" G8 Y$ v: {( j
  33. #include <linux/mm.h>+ I) _3 o- p* r
  34. #include <linux/dma-mapping.h>9 B0 \0 ^  B3 c7 E2 h

  35. ; h. c% r9 g0 r# ^
  36. #include <mach/memory.h>% Y) H5 k8 w5 H
  37. #include <mach/hardware.h>
    8 c1 `, l& B% l' k
  38. #include <mach/irqs.h>0 K' |. ?& P7 u( H! c% j4 ?$ U
  39. #include <asm/hardware/edma.h>1 {; V# {( p' g1 \+ `

  40. ( ]- p3 J4 `2 j; B
  41. #undef EDMA3_DEBUG' ]: B( q% ?# ]2 C/ y3 s# o
  42. /*#define EDMA3_DEBUG*/; M. q9 k0 d, w; U# n5 h
  43. 3 ]9 y) k. }7 N9 {8 \9 x- R
  44. #ifdef EDMA3_DEBUG
    ( A6 K1 V/ D0 @- G: \( [4 r! {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( D' k7 Y+ s4 V" {% O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 t8 P6 B* d: Y, U" r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). m% U5 n1 {9 Z: y/ a; n! y# O
  48. #else3 _" ^) Y+ y+ m8 b" W
  49. #define DMA_PRINTK( x... )
    % |) N) D$ V0 w2 M( R
  50. #define DMA_FN_IN
    " ^0 O1 A$ `! Y3 g$ u
  51. #define DMA_FN_OUT9 w2 O& K/ v4 }( s* X$ I! `
  52. #endif
    # w4 N8 H* p' g" F7 |; h

  53.   a, w; Q$ P! }( C. s$ E; I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% z) l% C7 t+ a# ]$ I& j" q
  55. #define STATIC_SHIFT                3
    - B, M8 @& @. q+ L, U0 S* I
  56. #define TCINTEN_SHIFT               206 s, o4 u: s4 a- {/ {5 f1 u
  57. #define ITCINTEN_SHIFT              21- K) e$ l% {4 N% j: e
  58. #define TCCHEN_SHIFT                22& E4 ^0 D5 ?7 h) _7 M+ z8 N/ x
  59. #define ITCCHEN_SHIFT               23/ ^+ v& F& n, f; O. T! `

  60. 9 Y  ^/ {2 p' r( [. _& q$ E3 ]
  61. static volatile int irqraised1 = 0;
    5 y9 N7 ^* C0 x9 n
  62. static volatile int irqraised2 = 0;
    2 n( l; s% v0 [" a# E
  63. % s  y% y8 P  }5 [- R" G) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 _1 x+ M9 [0 B* p' @: F3 k/ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. P2 ?% V3 K) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / |  k4 ^$ K, B; Q
  67. * ?/ K' F8 A9 b7 `2 ]- [; p
  68. dma_addr_t dmaphyssrc1 = 0;
    + a# r9 r) z. D. [% n
  69. dma_addr_t dmaphyssrc2 = 0;$ c( M! _0 ~( i4 X8 ]+ T
  70. dma_addr_t dmaphysdest1 = 0;3 z. K+ m2 i, R& A/ |3 F7 G
  71. dma_addr_t dmaphysdest2 = 0;
    4 r$ S) ^% k) J  B4 Y
  72. 2 l) u+ B* ?) F  W
  73. char *dmabufsrc1 = NULL;
    ) T* i* _' o. |, e& F0 O6 [5 ~
  74. char *dmabufsrc2 = NULL;
    : e* ?% Q. o' q$ B
  75. char *dmabufdest1 = NULL;
    6 o; D2 H7 x: Q4 S! j
  76. char *dmabufdest2 = NULL;6 w# ?% O% l3 u  Y+ b& a
  77. 0 ~8 |9 u/ w$ Z8 w0 @% R
  78. static int acnt = 512;
    : w+ m& J5 g1 w1 q
  79. static int bcnt = 8;
    ; M. C# V9 Z( q
  80. static int ccnt = 8;5 J% N9 X- K3 N7 |  ]# h3 ]; k
  81. * V4 ^8 T1 ^, ^7 F5 a3 K3 I
  82. module_param(acnt, int, S_IRUGO);- [. F2 N6 @* C& f' X9 }
  83. module_param(bcnt, int, S_IRUGO);' H9 C) r/ G& K; Z9 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 r& i1 b" k- ?# h
1 B( E1 l8 s' Z9 F& y6 X. y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 l/ ^0 Y+ R: Z/ barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o! F( b6 X* O6 U9 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) C* @/ `2 @/ ]6 B; X7 `5 Q
- p: n) e; V8 ]6 f* e
" _! E4 C# l8 K! d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 04:26 , Processed in 0.042270 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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