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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" v+ x% W- v  N5 @7 g% d+ c
  1. [code]EDMA sample test application
    % v' `  o- y7 ~$ @
  2. /*; W1 ?  }- d: C0 K
  3. * edma_test.c
    ) @# w9 A7 V7 o+ D* X5 v
  4. *
    / ^: K, q  R5 v; Z+ K3 `6 E
  5. * brief  EDMA3 Test Application% n. ?) D  d1 |3 [, O# j
  6. *
    - p8 l4 V( U; ~+ S
  7. *   This file contains EDMA3 Test code.' b0 J$ R3 d9 V/ F* g8 d3 o* L
  8. *
    / v3 U: E1 c3 p2 m9 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Y8 ^) N5 ]" ?9 N6 N& f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 E2 y2 F0 U# @& K; B$ Z0 W  H) s
  11. *         TO CHANGE.
    . j3 E# F" b0 l% y" h
  12. *9 t3 F- b6 N  D, d- Y) Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' s% W, C0 _* _3 Z: f- B
  14. *5 {. X0 ?) l2 M9 ~
  15. * This program is free software; you can redistribute it and/or, L6 [  |+ H: ?4 C, |; o$ ^
  16. * modify it under the terms of the GNU General Public License as
    : k; u) m7 `0 G/ W2 R; P' V
  17. * published by the Free Software Foundation version 2.
    / K; u( k# Q+ Z' q8 _: g2 D2 {
  18. *
    9 q! L# }6 ~, F" y! l/ _( p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 u# m$ N# c& X9 R  F
  20. * kind, whether express or implied; without even the implied warranty0 B5 g+ Z3 w% y7 |; u8 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + d& q7 t  C1 C9 s+ i- o$ C( X
  22. * GNU General Public License for more details.
    + \/ @  Y( L# C4 _$ u+ ~4 l
  23. */$ N" l1 f/ A+ }: Q' Y
  24. 6 ]9 W5 S9 |' q9 M/ z. ~/ P
  25. #include <linux/module.h>
    7 D  D: n: T1 d
  26. #include <linux/init.h>
    * [3 C) z) p( Z7 [3 H, o- @3 O9 W
  27. #include <linux/errno.h>
    9 C0 k  l+ U! |9 K4 M* j
  28. #include <linux/types.h>! N( D& D0 t4 `& e6 Z
  29. #include <linux/interrupt.h>/ l) w' |. P; j% Z
  30. #include <asm/io.h>
    ) `; t$ ^0 Z+ S+ \+ ^+ O
  31. #include <linux/moduleparam.h>/ @: l; f: Y; F: ^- I. n2 `% G# }8 j
  32. #include <linux/sysctl.h>" C* f- }  k/ b8 {8 Q& p# i) H
  33. #include <linux/mm.h>3 V! [/ O. W% a* c% x  e
  34. #include <linux/dma-mapping.h>
    % l8 A$ T" ?4 d  n% t

  35.   p2 Y7 \8 B/ v9 W; s+ p  ]0 I% [
  36. #include <mach/memory.h># K& |/ T7 r! F- ]9 |) I; \
  37. #include <mach/hardware.h>9 @- p' U7 a; \3 z
  38. #include <mach/irqs.h>6 n9 a+ p! B3 a( ]% m( G! g7 i
  39. #include <asm/hardware/edma.h>4 P& m- W" h6 F+ k1 x. F) h( i0 N

  40. 9 N& y/ n& D- Q1 I/ f! O3 F) ^$ d
  41. #undef EDMA3_DEBUG
    + c( m1 s: ?  |
  42. /*#define EDMA3_DEBUG*/
    9 Y& g* W+ `6 A/ {% Y

  43. 0 F+ _) p6 y6 Y; ?0 Z2 a( R
  44. #ifdef EDMA3_DEBUG
    9 a: Q7 Q9 L) U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 t; O2 ?$ b# {5 s; ^$ V; w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) R# r; V( Y0 o0 v8 E5 f2 n! e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ B! j" P4 L3 l4 c" Y
  48. #else6 `, w8 v  k" J; a
  49. #define DMA_PRINTK( x... )
    & I' y$ ^. g8 f. N/ M
  50. #define DMA_FN_IN/ D/ _8 _+ |/ R: J
  51. #define DMA_FN_OUT3 {) b6 s5 ~; g
  52. #endif
    4 |; }/ O8 d1 C3 k& w6 }
  53. / g' i' p- w1 R2 a$ v3 h$ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 u8 A- t! ]% d/ v
  55. #define STATIC_SHIFT                35 n, G3 |2 A: I2 C5 B; F' x* c2 d
  56. #define TCINTEN_SHIFT               20
    3 e9 k% c4 P5 s& {7 q
  57. #define ITCINTEN_SHIFT              21* k  L" n; S0 a& Y
  58. #define TCCHEN_SHIFT                228 u: `) B9 p, b  h- r7 c5 s# E8 o
  59. #define ITCCHEN_SHIFT               23; f$ N/ |: L# U& l" Q& U: Z/ U

  60. + f  k# D4 `6 _2 {7 Z% R
  61. static volatile int irqraised1 = 0;$ V3 r( ?) A! v8 Q0 i, R
  62. static volatile int irqraised2 = 0;
    0 E0 f3 W1 r' p) i2 v
  63. . x) c2 M4 v$ L+ z! @6 `7 J9 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R4 ^+ ^; j6 a8 x- k) N( b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 e: w: c5 U2 t! `3 K5 B2 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M& _9 b6 h( u( b  ~+ l; `; p
  67.   j, b) `8 F' a: @3 V
  68. dma_addr_t dmaphyssrc1 = 0;
    : n9 h* L& c: L3 v9 t
  69. dma_addr_t dmaphyssrc2 = 0;, F) `9 f1 K! E' z7 C
  70. dma_addr_t dmaphysdest1 = 0;: ]* ~. L  l0 f: ~! ^) ^5 Y
  71. dma_addr_t dmaphysdest2 = 0;) W3 B3 N7 e* [3 ~% f; R6 N3 Q

  72. ) Y% N* h' o# @% ?) s) R9 P  F/ K
  73. char *dmabufsrc1 = NULL;! R; G0 i' s2 x; E
  74. char *dmabufsrc2 = NULL;# k% v9 X/ z7 h& K" M7 ~
  75. char *dmabufdest1 = NULL;
    - ]9 r) X; n+ {4 C: x5 y% e
  76. char *dmabufdest2 = NULL;8 o" j5 M7 D* ?# b7 ?* S$ @
  77. # {' l, q5 B3 i9 u! B  K9 P2 d
  78. static int acnt = 512;+ i. G7 V8 R9 j" h2 N! S6 _
  79. static int bcnt = 8;' y+ N, y7 a3 J4 I9 e4 W+ w
  80. static int ccnt = 8;
    7 `. z3 x8 {# g  E2 a9 z' o* o

  81. 4 `& u2 y; {( J3 m4 S
  82. module_param(acnt, int, S_IRUGO);1 ^3 N( R+ o! M3 o; d' K
  83. module_param(bcnt, int, S_IRUGO);
    8 U/ q+ J* l: G% Y: [3 p% b5 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: _! w3 W5 q1 @* f* h- A% Y2 j
; h0 {$ O$ R, Q8 _7 `. c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. q2 }( h$ j$ f3 }/ @' \0 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ W! p# {/ s0 b5 p6 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 r) N2 Y& ~) O0 A, T

* C- Q1 N. F$ N* n4 d, p/ Y$ f8 l* V7 @, T& q* M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 06:00 , Processed in 0.039479 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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