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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I) Q- G3 m7 T% i8 c2 k
  1. [code]EDMA sample test application1 x& o4 t* L9 A4 o. f
  2. /*8 U. n2 h+ K6 x: d% i1 x: R6 p8 i  s
  3. * edma_test.c
    3 U" t* i7 R( v" _
  4. *
    ) E1 B/ }0 d2 e2 f2 _3 H7 b
  5. * brief  EDMA3 Test Application
    ) Y9 k& `) B2 X  o# y
  6. *% w* t" A# n! i* h0 |' W/ y
  7. *   This file contains EDMA3 Test code.# D8 v$ Y  ~$ A
  8. *6 m$ x0 A" _$ w! g" U0 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 @) V8 o" W2 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 U3 w7 `5 l0 e) q- [/ Y. G
  11. *         TO CHANGE.
    + e4 M$ J9 V& c: i$ M, y
  12. *
    & V" P5 H) D5 i8 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J6 ~" e' |$ z+ U% |
  14. *( P- M$ x' j2 d+ q+ u' d8 _
  15. * This program is free software; you can redistribute it and/or+ f- \. z9 O/ k
  16. * modify it under the terms of the GNU General Public License as
    9 o5 ~& U& i! V' `* A- |( W
  17. * published by the Free Software Foundation version 2.7 E) j% ]& n! J% |6 A9 k
  18. *0 X3 p, K/ W; V1 ^, d* Z. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ]8 _( X3 N/ E, [  @3 {. y8 H/ ~
  20. * kind, whether express or implied; without even the implied warranty1 l4 V0 c* N1 H9 T( Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  b6 Q9 k7 ]8 ^+ h
  22. * GNU General Public License for more details.4 j9 i- x8 t0 c4 T
  23. */
    " U$ }$ I% g7 {# J) r

  24. , p/ }  [) l# x- y: {  j; T7 n
  25. #include <linux/module.h>! S% \. c2 B8 ^% K9 S1 n5 ~
  26. #include <linux/init.h>
    9 I9 A. W% r; [0 A6 U8 P
  27. #include <linux/errno.h>& R1 y. Q* y( a+ ~7 O$ Z" a. O
  28. #include <linux/types.h>: f# b1 F7 I) x3 d- W6 z1 A
  29. #include <linux/interrupt.h>$ ^) l- o+ e3 @2 `/ ^8 E/ P' P
  30. #include <asm/io.h># M  b7 L  n5 l
  31. #include <linux/moduleparam.h># T; H) l" d+ G( F9 t
  32. #include <linux/sysctl.h>
    8 y5 o/ K+ p4 h: Y5 l5 V8 K2 G8 T+ v
  33. #include <linux/mm.h>; Y5 B- ]; t. [7 m" J' B
  34. #include <linux/dma-mapping.h>, n$ @& T% Y+ O7 q, L& U
  35. # C- A. {# x, ?3 h/ m9 X! \
  36. #include <mach/memory.h>; J, N. ^5 v9 O/ \! O4 P
  37. #include <mach/hardware.h>9 R$ Q% D/ b7 a" J' M9 {; f2 B- q
  38. #include <mach/irqs.h>
    0 l" @* P! D/ _% W. b6 H% e( p  l
  39. #include <asm/hardware/edma.h>3 c+ I9 L) e9 z% t8 Y5 S8 }
  40. 7 [- U3 A* J) V1 e% Z1 M0 r
  41. #undef EDMA3_DEBUG
    7 `+ y/ H# c) Q+ D+ n, R) l4 ~
  42. /*#define EDMA3_DEBUG*/' S% q5 i  m7 m5 g

  43. & u2 }/ |: F( S% s7 r' `3 e, u
  44. #ifdef EDMA3_DEBUG
    ( d' P- _# z, R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( n9 U: y# O/ }5 S: O% X1 W4 ^- t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ F9 }9 x! s% R+ m; i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @1 D4 ?! J! F' {* s9 k* A4 D- K' h
  48. #else
    4 @8 X4 V9 J% l  s0 l7 o
  49. #define DMA_PRINTK( x... )9 X* s, d& O0 a" Q0 R
  50. #define DMA_FN_IN
      [& F. l3 m' P- R. L" s( V
  51. #define DMA_FN_OUT' p9 ]& s8 m6 P* D2 C, ^
  52. #endif
    + b; k( r# T5 n. X' e

  53. % H9 i7 N, O, y- P* S3 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! s) P  _, N5 |* S0 x5 L
  55. #define STATIC_SHIFT                3
    8 e% j1 K) U5 `' P) {3 ~$ d& f
  56. #define TCINTEN_SHIFT               20" {4 u! m7 f9 U: i& Q6 }5 J
  57. #define ITCINTEN_SHIFT              21
      V0 ]( F1 I/ S" i; U
  58. #define TCCHEN_SHIFT                225 x5 P2 f4 s* h% b; o0 u( a
  59. #define ITCCHEN_SHIFT               23
    . O/ n* X% U3 h7 K3 F! t

  60. - |9 \4 {" Y1 B" v( {3 @! d! S* R) v/ I" Y
  61. static volatile int irqraised1 = 0;% I: I' Z$ E: {; V# X5 `
  62. static volatile int irqraised2 = 0;
    9 @2 Y. N" ~) ^( X3 P. \8 Q8 I

  63. & c! Q: n; A# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s6 z* q+ t$ A* r) b: q$ q. I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. h' D; n* a* a$ W; t' P9 e5 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r. o% y- B# V/ _
  67. 0 ~+ j- V6 a/ z- e2 m. f
  68. dma_addr_t dmaphyssrc1 = 0;" I! u/ t/ I3 K; W2 \: |
  69. dma_addr_t dmaphyssrc2 = 0;+ Z5 I/ u: Z& {' e
  70. dma_addr_t dmaphysdest1 = 0;
    # W6 U1 V4 e1 o3 o& }2 `6 b
  71. dma_addr_t dmaphysdest2 = 0;/ s  O/ I' K/ E4 `: w

  72. 7 Q0 K  G9 @' Y9 a4 G
  73. char *dmabufsrc1 = NULL;
    + G# z2 @6 H" ^$ ]
  74. char *dmabufsrc2 = NULL;
    4 P0 V' K% G. Q, y9 n
  75. char *dmabufdest1 = NULL;  ?4 w$ n: N+ u
  76. char *dmabufdest2 = NULL;( s- i+ K2 h3 Q; ?4 |1 G
  77. : {# S) G" t9 r$ O( l
  78. static int acnt = 512;6 I5 r; h# o: z% `: k
  79. static int bcnt = 8;
    1 Z3 @3 Z( V  s5 i* C  o, i% N) ^
  80. static int ccnt = 8;0 C* v# z; D. t. _# Z1 l: u$ o# Y
  81. # G# d; R/ g6 L6 K0 t9 u  q: V" B
  82. module_param(acnt, int, S_IRUGO);) D! m  [9 K9 M
  83. module_param(bcnt, int, S_IRUGO);# |7 @, o% _0 x2 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ~. A/ S* q- T& [0 e. l% }+ M5 _$ n( ~# e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Y- w! S7 X" X- \+ q6 B! X
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p4 ~2 X0 {3 [  u7 l* @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ a/ @, P, d, }0 g+ Z4 s+ {8 H- N

8 N+ o- k" s6 @/ e4 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-25 02:51 , Processed in 0.048213 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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