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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' e% N$ c- z# }$ U' W8 L; E
  1. [code]EDMA sample test application, n, R# Z6 x% H: j- t
  2. /*
      ^9 z) s9 F% c; e. w, I  l
  3. * edma_test.c9 R+ B0 P2 y8 t( G
  4. *; I) v, }2 s/ o5 U
  5. * brief  EDMA3 Test Application$ [- [) B0 k+ U, V
  6. *
    & r% P  p; f' ]6 X1 l7 I
  7. *   This file contains EDMA3 Test code.+ l( s7 ~% M: P( S
  8. *$ W7 V# w0 h' u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r7 [* }* M9 `2 q) g0 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # V: i3 n9 H; H! F" [& [  {6 W1 u' u- I
  11. *         TO CHANGE., K" [/ s! u0 j. s  W
  12. *# C; S# I4 F/ A8 E" I' l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 y' m9 f: S7 B3 S; D0 D
  14. *
    1 S! i8 `7 B, N! s
  15. * This program is free software; you can redistribute it and/or
    : K" N; J3 h, f  @
  16. * modify it under the terms of the GNU General Public License as
    ! o' l. a8 D4 F: q. n
  17. * published by the Free Software Foundation version 2.
    7 B: ~3 {! S+ [4 N7 t! b; u
  18. *
    ( i# V( ^" Y  L9 b& Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 g" ]+ U# r& u$ d$ o
  20. * kind, whether express or implied; without even the implied warranty
    9 \1 d- w- D" i8 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 d; p- Q9 l$ ?, V, m
  22. * GNU General Public License for more details.
    8 g4 Q5 x+ q- G/ C
  23. */
    8 H& E9 i- {2 E/ i

  24. - V3 F# T3 v9 V/ B: f5 j7 ?
  25. #include <linux/module.h>- v: ?7 d# |0 j( I
  26. #include <linux/init.h>* i( Z- O/ ~$ o+ Q! e! l
  27. #include <linux/errno.h>( R- G4 v9 U: I+ Y( d% j
  28. #include <linux/types.h>
    1 `" _1 O6 T4 z5 W
  29. #include <linux/interrupt.h>/ q, y+ H$ {0 z9 ^; a
  30. #include <asm/io.h>
    ' s2 d, O( Z% I1 M6 ?
  31. #include <linux/moduleparam.h>) R  L$ s& \6 ~5 P7 Z6 W( s  Q
  32. #include <linux/sysctl.h>
    , B; g- j) P" O3 l) w( s
  33. #include <linux/mm.h>
    # ?# v- i3 {' f
  34. #include <linux/dma-mapping.h>
    " X& P) K8 K+ ]1 w* [4 o
  35. , P" ?; g- p2 `; ?5 k0 Z) A5 y
  36. #include <mach/memory.h>
    ! }( c2 x- N0 y) w1 M
  37. #include <mach/hardware.h>& w, ~7 Q9 ?. v% t
  38. #include <mach/irqs.h>2 Q& Q$ U0 M& p1 I# ~
  39. #include <asm/hardware/edma.h>
    ! f. ~6 j0 N* {- y' F8 F
  40. * h3 N! O/ ]' u" |. j: @
  41. #undef EDMA3_DEBUG
    ( [& B( {& n" D$ V/ S/ H% s
  42. /*#define EDMA3_DEBUG*/% ^9 P1 {+ Y$ p  b
  43. 5 h/ U0 U/ D* M* G8 u
  44. #ifdef EDMA3_DEBUG
    ; d/ [3 P* R9 {1 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), @5 l) l, u+ I  O, r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 _7 h, D8 f% g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' s/ P& P7 L! \* O
  48. #else
    % e' D# W: A5 {/ B, w/ l
  49. #define DMA_PRINTK( x... )
    ! N( h4 V7 F8 X4 A1 E7 E8 X
  50. #define DMA_FN_IN8 ?* d* s8 m3 S
  51. #define DMA_FN_OUT
    . a9 j/ v! X6 O( X: v) J- y( h3 i
  52. #endif
    * y8 K8 d: a: v3 `: l
  53. 9 V; M( V+ M! i" i7 a* V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 F4 m1 h! \; N6 w3 t, ~, g- p
  55. #define STATIC_SHIFT                37 j6 P3 _+ y3 V! N' a) E9 m
  56. #define TCINTEN_SHIFT               20
    ; ]9 o7 U  N. F
  57. #define ITCINTEN_SHIFT              21; x7 G7 i& h, M2 Z9 D
  58. #define TCCHEN_SHIFT                22
    % f5 H/ Y) T" h$ L' _. t7 \
  59. #define ITCCHEN_SHIFT               23, @) O; o4 J* m. j2 {( X. Z

  60. $ b2 x3 T9 z# J/ z
  61. static volatile int irqraised1 = 0;! _- ]: e+ M$ P
  62. static volatile int irqraised2 = 0;& I6 g, f1 t* G6 e. E

  63. 6 M, I  ~, P) g' n! T* V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k0 p: Z- H' F# w- P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f1 Z& A9 j/ A8 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 a! Z. z- ?* q# D5 I) o

  67. * U0 r, G6 r; ^+ K, c
  68. dma_addr_t dmaphyssrc1 = 0;
    + T& U/ {  G2 A0 @5 E
  69. dma_addr_t dmaphyssrc2 = 0;; d& n3 i6 R. A$ s: p) q! T3 R
  70. dma_addr_t dmaphysdest1 = 0;
    3 [* [( G# F/ f7 l
  71. dma_addr_t dmaphysdest2 = 0;' K3 t0 ^" G9 H9 I
  72. ; A0 I) \6 `# R+ z# U# I- L
  73. char *dmabufsrc1 = NULL;
    ' P& a# Y  w( @; F/ p
  74. char *dmabufsrc2 = NULL;
    ; F5 k# }7 n: N
  75. char *dmabufdest1 = NULL;
    . s" M5 F% |2 C' t% x1 M
  76. char *dmabufdest2 = NULL;
    4 ^& V% O$ `6 t% e* t4 A  ?" V

  77. + e/ w* a" L6 N/ L% o
  78. static int acnt = 512;% R* b  d1 Q4 u  s# B
  79. static int bcnt = 8;2 {* {: |) A2 J6 v+ H% A
  80. static int ccnt = 8;; }# m, s% u9 M( p
  81. 2 j/ F( v' J2 B# A! e2 A
  82. module_param(acnt, int, S_IRUGO);  _. w1 A  P# X% P! L: M7 ^, v
  83. module_param(bcnt, int, S_IRUGO);
    * V" {5 x4 v/ s: k' m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* U3 D1 @0 b3 q6 s1 p+ ~
$ K' j# J& i; q; f* D) h' S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 Q2 k6 C0 Q8 d+ l- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 M) K0 ?: D$ j) K* H  F0 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- j/ R6 P+ Z1 N3 x( a6 N' g
1 ]6 C$ v% l  Z9 F. s5 B* ?
0 r7 d  g' ~. e6 E/ u3 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 13:24 , Processed in 0.042569 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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