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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! L) z1 u7 `: I2 V, [. u& y
  1. [code]EDMA sample test application
    0 {3 O+ T) y" [( d
  2. /*; E- G4 Z2 b# x* c# x4 x
  3. * edma_test.c
    4 n/ q7 }  o, [, t1 l+ S4 f
  4. *, w4 Z1 @: ?9 `6 O+ r
  5. * brief  EDMA3 Test Application
    * ~, f! p( T2 B8 n" j, e3 C
  6. *- ^+ V2 I/ k" t7 ^1 W' i' [' b
  7. *   This file contains EDMA3 Test code.
    0 e' o+ \4 o8 K% X5 s% U
  8. *
    3 a  [0 C/ z/ j+ e& m- N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* r9 r+ g+ i( e- T0 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m4 r4 s- v9 b, @% c2 ~! w
  11. *         TO CHANGE.
    * V: I1 `) M, Y9 N4 q
  12. *" [, a- y; S, ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ V* z* `/ O* T* t: M
  14. *
    6 S5 j: Q) f  z0 z- a# w) \
  15. * This program is free software; you can redistribute it and/or
    7 W2 f! z  a$ t/ \3 a
  16. * modify it under the terms of the GNU General Public License as
    / W/ m9 [0 E( L! z
  17. * published by the Free Software Foundation version 2.+ v. \9 h# n: ?& a4 u% g- U
  18. *
    2 w% z" k' r) [/ T! C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q2 E7 @- ^8 T/ _* M
  20. * kind, whether express or implied; without even the implied warranty7 `2 M$ w3 m2 k  v# a1 c4 w! x& S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, ~" g( N2 c" m5 ~* r
  22. * GNU General Public License for more details.- u8 ^# p; J3 b  R
  23. */
    8 S# i! Q- }8 \& T9 `

  24. 2 R+ |+ T+ \4 L6 Y+ c  ?- G) J
  25. #include <linux/module.h>' D& x+ Q! X2 Y' }5 R$ o& K
  26. #include <linux/init.h>
    ! s0 ~9 @; x; B6 u1 D8 }2 M) [+ [
  27. #include <linux/errno.h>3 P  b8 M6 d, I, o! K/ N: l. T. c
  28. #include <linux/types.h># P4 z- _; S3 L# Z$ g- z
  29. #include <linux/interrupt.h>: F4 x6 {3 n! ~( J# l! _
  30. #include <asm/io.h>- s3 [9 L. _! ~: ]6 O' w
  31. #include <linux/moduleparam.h>6 P7 t$ s8 E& H8 A4 k4 g7 N
  32. #include <linux/sysctl.h>
    * Q9 A- j4 \7 q) m
  33. #include <linux/mm.h>( W2 g1 a( M6 h; o% M& f
  34. #include <linux/dma-mapping.h>: Q1 a$ N, @& D1 [' W; p
  35. / b( D/ g+ ~. \* P0 T7 n
  36. #include <mach/memory.h>5 v9 a. m6 |/ J
  37. #include <mach/hardware.h>- y( E& o7 Y$ N3 v
  38. #include <mach/irqs.h>$ G4 g# _3 I5 A, O, l
  39. #include <asm/hardware/edma.h>
    % ~( v: \# \' q' d6 v

  40. " F  Z% Z% D- _" z3 ~
  41. #undef EDMA3_DEBUG
    3 P9 H; J; E5 Q) Y5 e. \" D& l
  42. /*#define EDMA3_DEBUG*/
      a, W8 X9 p6 L9 t& |. K- o  T* N

  43. ! f$ e" {5 m* M
  44. #ifdef EDMA3_DEBUG( X0 y! Q' l, t0 @1 r* A- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 w! S6 s$ \8 A: T* ~1 h7 n# b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 b, I8 I  V+ E2 Q/ w7 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; ]( Y$ P) }3 W7 b" |8 ^; H  u  ]4 a
  48. #else
    , C9 P, [; _4 X
  49. #define DMA_PRINTK( x... )2 Y3 o0 N2 Y1 C% E8 ], f# g
  50. #define DMA_FN_IN
    " k( s/ ^" M, }5 x3 m+ b
  51. #define DMA_FN_OUT
    . O( u2 s) {  B  ^8 z
  52. #endif7 H: N! x- k+ G3 _, o) L, }* ~

  53. 4 r% C' ~6 f# S( \; J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 T. C4 G" a0 H% A! K' H
  55. #define STATIC_SHIFT                3
    0 k  z& ~; n- c% k5 b( \( r' D
  56. #define TCINTEN_SHIFT               20
    ( K* Q  k1 n- }' }) I- Q
  57. #define ITCINTEN_SHIFT              21
    . j& l; y) h( [& u) L4 Z
  58. #define TCCHEN_SHIFT                22
    1 {; R( J' u. }* y& u5 M3 t
  59. #define ITCCHEN_SHIFT               238 e! b8 K; t% N! k1 U
  60. 0 D1 Y9 \* \/ ?0 L
  61. static volatile int irqraised1 = 0;8 A" V4 a' j' X( L% B' p
  62. static volatile int irqraised2 = 0;
    2 {8 I7 u; n3 X/ M$ ?; H' U0 X
  63. 9 S4 q0 u) e" q8 h, B2 ^/ K" w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?5 c2 K7 m1 H/ D$ D: @7 d5 N: |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 v+ k3 V4 z& P7 P* p4 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 g* T1 m7 Q' k% x! N- s. Y" t& p9 T
  67. 6 ]# X, Q, p1 t/ m/ R
  68. dma_addr_t dmaphyssrc1 = 0;
    / K5 N3 r1 N4 n4 M' C
  69. dma_addr_t dmaphyssrc2 = 0;
    ; T' \8 b* d$ j
  70. dma_addr_t dmaphysdest1 = 0;3 {$ H  w7 s. `. `. G1 q/ f: b
  71. dma_addr_t dmaphysdest2 = 0;
    $ ]+ D2 `; S6 w2 A; d& g0 m# q

  72. + Y3 Z1 c  K5 a# k! \
  73. char *dmabufsrc1 = NULL;
    + R, L2 l; ^& ~- p% O& @+ b* e
  74. char *dmabufsrc2 = NULL;
    6 ]8 x$ R3 E" w2 ~& _) U% ~. R4 h
  75. char *dmabufdest1 = NULL;
    1 \1 P* z1 v: C: T2 |: l5 A) _7 r
  76. char *dmabufdest2 = NULL;: z' d/ C2 [+ P! ~- j

  77. 7 @) t2 B- p' p; G6 m3 G5 D* b
  78. static int acnt = 512;$ u- |) T6 y* q9 `6 i/ M
  79. static int bcnt = 8;$ k$ x* h9 I! K( g8 E/ @' b( w
  80. static int ccnt = 8;0 ?4 I( I/ _. S5 `5 C$ b% f

  81. $ R8 g5 b$ j2 D7 G
  82. module_param(acnt, int, S_IRUGO);
    ) k5 t6 {! A3 y" h2 W: T
  83. module_param(bcnt, int, S_IRUGO);
    , t: _" g+ R. g- i1 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( S/ s! c$ w( q, r# V7 k" A# I
9 X. i9 U( Q  ^% w( K5 z% G0 N* c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 I" X9 I, [- t8 G4 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 K9 h! v( n- ~! H2 ]8 ?9 m* r9 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ~7 g3 x! y. n6 O  X! _* G% S# d
9 p, K5 q9 l9 i# J4 P/ u" `8 J7 `  _* Z& Y$ l& ^* C6 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-9 22:08 , Processed in 0.040502 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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