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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) i( }: P+ q, ]- ?
  1. [code]EDMA sample test application# B1 t! ?1 t( m
  2. /*
    1 w# ^% r0 p8 b0 u; t4 }
  3. * edma_test.c: u- I! h% t' N* w9 h
  4. *5 v+ z+ g+ A, |( q* }. B
  5. * brief  EDMA3 Test Application; P& ]! Y% p. O
  6. *
    7 a7 R* e' C7 G% X5 [1 d. d
  7. *   This file contains EDMA3 Test code.& U! X! C  S8 M4 z& {0 D7 f
  8. *. v- A3 s  Q, b5 C' H; D( y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " A4 u+ O% A1 b2 i# P3 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) s; z: r) T/ s) y
  11. *         TO CHANGE.! @* z" C: ~9 G$ U$ i  j
  12. *9 Z+ v5 ~' Y0 I9 {6 K# F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, A1 G9 }$ `1 _9 s( r
  14. *: s6 f# ~3 e% M0 v9 S6 m
  15. * This program is free software; you can redistribute it and/or; i9 D* k) i& E& f& e7 u. K
  16. * modify it under the terms of the GNU General Public License as9 w/ n; m; E5 t9 a, a; {
  17. * published by the Free Software Foundation version 2.2 u5 |/ `* w6 I4 H2 h
  18. *
    ' c6 _8 P& h; y- a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 R3 f+ r. a- p4 y! v# ]- P
  20. * kind, whether express or implied; without even the implied warranty- y. M3 d/ K# \) z# i' [! l  k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ e  J  Y% s1 t0 O, i: R, |! S/ {' O
  22. * GNU General Public License for more details.7 }9 {- A* N. ?! I  n' ?
  23. */
    7 [+ l0 E, o: e( x& O, \
  24. - p, z# p8 B3 r0 _3 m' z0 A% F
  25. #include <linux/module.h>. G1 H( p2 m; I- R3 m2 G" {
  26. #include <linux/init.h>9 l3 v* b& J- U5 w
  27. #include <linux/errno.h>
    0 \3 y0 W' t( t8 A# {: G! t3 D' I
  28. #include <linux/types.h>
    + `* _7 w  d7 p  |
  29. #include <linux/interrupt.h>1 u" S8 V3 Y- k5 W% h$ X
  30. #include <asm/io.h>
    5 N! D& H" }9 ~9 v& l" ~% r$ P
  31. #include <linux/moduleparam.h>
    " H' o. O; W9 B# J+ w/ `. @& k8 E
  32. #include <linux/sysctl.h>
    , Y' @" v7 Z" Q. @) o% S7 e
  33. #include <linux/mm.h>. J: p& V2 O% Y8 H
  34. #include <linux/dma-mapping.h>6 K0 U' u; [% D. y: c5 S8 h
  35. & z; e' j4 `- p+ h: X4 z
  36. #include <mach/memory.h>
    ( P  z- q& r* b' `8 `% B3 i0 s  O3 }
  37. #include <mach/hardware.h>7 A8 Y+ t' d; W
  38. #include <mach/irqs.h>
    8 {$ Z$ L3 k8 [0 A. v
  39. #include <asm/hardware/edma.h>
    1 {* [* K2 _+ [8 I& K
  40. ; v+ `- }" }2 h! ?, x
  41. #undef EDMA3_DEBUG0 Y, d- I2 L2 h1 i9 n- S- ~8 B
  42. /*#define EDMA3_DEBUG*/. A0 _. `$ Y+ \1 a: ]! y

  43. 1 s9 \' i: h! u, l! V/ g  S4 p* k
  44. #ifdef EDMA3_DEBUG  _" z1 D* q( P/ D# o! Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 z$ k  q' ~3 |1 ^& w0 P! j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; f  T3 |! F0 d7 V" p0 B9 v! A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& \* Z/ L* J' w$ S% F0 ~
  48. #else) m0 n! `& S6 J7 b* x4 s
  49. #define DMA_PRINTK( x... )/ M2 u, P5 F% M) h! p  a: J
  50. #define DMA_FN_IN
    1 a- S7 R* o# c" _% j( |6 ^
  51. #define DMA_FN_OUT
    . i& _8 M  Q4 {2 Y" M. M' _. l) E
  52. #endif+ m9 o/ D4 s* x% I/ z! x, _
  53. ; L; F/ i1 t2 _! O' E1 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * _8 v: h+ B; b2 C- l0 T
  55. #define STATIC_SHIFT                37 G5 W& m5 M, P( ?, E; @
  56. #define TCINTEN_SHIFT               20
    4 H; Z/ l% N, v1 ^: f: m2 Q6 W
  57. #define ITCINTEN_SHIFT              21
    ( @0 j1 p" e8 _5 X
  58. #define TCCHEN_SHIFT                22: m# q: }  Q6 R9 H
  59. #define ITCCHEN_SHIFT               23
    + C+ U3 r2 k- a: q  s
  60. 0 }- H, h: D  q$ n# Z3 D4 f' i
  61. static volatile int irqraised1 = 0;
    " @* v( r( _8 C2 Y0 a
  62. static volatile int irqraised2 = 0;
    ' ~7 G7 T( i! R2 ~

  63. % }1 m% L& V1 A5 M) Z9 M+ m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      M5 |, j) w0 t* b) _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ r4 G& ?, c6 V/ _+ I$ m" p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S1 l9 v) L4 q  U* y) R/ \

  67. 9 b% z1 Y1 n  r% J' [4 o6 q3 C
  68. dma_addr_t dmaphyssrc1 = 0;7 c3 i& g1 Z& G) k# K
  69. dma_addr_t dmaphyssrc2 = 0;- d/ S4 u9 i0 v
  70. dma_addr_t dmaphysdest1 = 0;
    ' _1 w+ N; {* o; z- m! b  r
  71. dma_addr_t dmaphysdest2 = 0;
    / F* ?( u+ o& P# h& y2 j
  72. : M# f$ S2 k9 g" {+ [, \* ~
  73. char *dmabufsrc1 = NULL;
    " r0 }" X: w5 s/ O( S
  74. char *dmabufsrc2 = NULL;
    0 J1 R$ Z+ `& ]! Y( f" c# `
  75. char *dmabufdest1 = NULL;! d- o3 p* @  B, n2 s
  76. char *dmabufdest2 = NULL;
    5 w, A, k% U) D, p- l) O
  77. ) H3 s, {. {7 X/ e0 m7 q( G3 ?6 o
  78. static int acnt = 512;% H& e; K; |/ _6 z
  79. static int bcnt = 8;
    7 N  X* F: `- P6 q# F2 b$ D4 f( n
  80. static int ccnt = 8;
    + Q' I9 _+ e! G% ]( `/ P+ y9 b. j
  81. , n2 J& G. Z$ U1 h8 ?0 Q+ ?
  82. module_param(acnt, int, S_IRUGO);/ k! ]' R( g3 b% g! d6 T: ^/ z
  83. module_param(bcnt, int, S_IRUGO);  U! T7 S; X0 b" {# {  v7 I) {8 `8 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  F2 O3 Q/ g7 R! b/ F
* u  A- \+ y+ D' T' I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R* j3 h' U% \/ ]. l+ y  X1 b+ Q
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 s4 z8 v# o) N% _" V( n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 z( k9 V, j# J0 v+ a9 I1 x
, u' k" G" A% F8 s  ?
# k# F" f9 T# z1 f. b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 20:28 , Processed in 0.040510 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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