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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * g2 e) B* \- ]6 m/ ]
  1. [code]EDMA sample test application
    - b2 _7 F5 d) o( y
  2. /*. i$ d* b$ L) x9 e$ a* X% h* a5 y
  3. * edma_test.c
    % P7 F! K$ t' r$ @7 Q
  4. *
    " Y' B5 |* j! K0 V5 n
  5. * brief  EDMA3 Test Application# Y, V" h+ s* i
  6. *4 E2 ^  }0 |9 X# s: l& q( Z
  7. *   This file contains EDMA3 Test code.! p- g: M8 M; T1 H
  8. *0 c& o9 \" ?! f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% L* Y1 {+ b; E! R5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : E: u9 e9 C# Q; K5 q! A
  11. *         TO CHANGE.
    8 h5 B- O; S0 W4 P. V
  12. *& f' t. m9 `" L6 x; E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % n# q; @! d% h3 t3 h$ p7 C* W! k$ d
  14. *. ~  h4 z+ z+ |/ Z. o
  15. * This program is free software; you can redistribute it and/or
    $ ?/ H+ i7 C, {- [& ~: Q
  16. * modify it under the terms of the GNU General Public License as- J& i# w8 U1 H4 |
  17. * published by the Free Software Foundation version 2.. s$ H6 o9 c1 B1 t5 e  y
  18. *5 k1 {* t, J; D- }- p  C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 j$ C+ }4 Y* Y% n7 @8 ~
  20. * kind, whether express or implied; without even the implied warranty& z1 C# }. E$ B; B$ [8 P3 B  h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 T8 I1 t  v) X/ J
  22. * GNU General Public License for more details.7 z; ?7 E/ \$ e
  23. */$ @6 |4 b4 `4 f2 b# b
  24. ( e( T8 z. r% |) x
  25. #include <linux/module.h>3 V. k2 I4 _' C. X2 j8 _: t
  26. #include <linux/init.h>
    ' d! W0 P% a1 n# n: \
  27. #include <linux/errno.h>7 s; [$ [+ Z# i/ L
  28. #include <linux/types.h>
    $ H) Y# G5 j( K9 R! ?/ o( Y
  29. #include <linux/interrupt.h>( O( q* R: M& o
  30. #include <asm/io.h>- ]* R) f: S+ b6 N2 Q* A+ r
  31. #include <linux/moduleparam.h>
    : c; d8 I7 i0 ^4 C, u  ^$ n& Q
  32. #include <linux/sysctl.h>
    & p3 j0 Q* e& H: Z
  33. #include <linux/mm.h>
    + M- a) l0 j* ^. G
  34. #include <linux/dma-mapping.h>1 X- P. b% f6 b/ T# ?1 [! h. I

  35. 0 j  Z* O4 n/ {* e. G
  36. #include <mach/memory.h>% ]7 \' k+ O( _% q2 _$ }6 d
  37. #include <mach/hardware.h>* p0 q( Y; [* h% T4 l- m; r9 k
  38. #include <mach/irqs.h>& r+ G4 v' g! ?! b7 v9 M
  39. #include <asm/hardware/edma.h>
    2 U" [" U# \% ?# U* r+ K
  40.   D% e6 q4 R" g# x% W: n3 t" Z0 f
  41. #undef EDMA3_DEBUG# H. g( k8 ~9 G3 y7 f
  42. /*#define EDMA3_DEBUG*/
    7 T0 z* J# ^* D& k0 p9 [, H
  43. ; x& c; s5 Y) r
  44. #ifdef EDMA3_DEBUG/ ]: p# P  P$ C# F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . N' Q3 u  Z5 C! q. C8 Q3 J8 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; S- R2 s$ Y, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g8 G( S  n& h/ ?: [
  48. #else
      {( u1 Z, V5 @, e* L
  49. #define DMA_PRINTK( x... )
    5 C- o# c8 k* z* @0 d8 i
  50. #define DMA_FN_IN
    ; U% S# i5 t5 b  l( t" K" ^4 ^
  51. #define DMA_FN_OUT
    5 ]' j# b0 f4 ^
  52. #endif
    3 ?' t) T6 I4 t7 w* K

  53. ) d8 I' {( d9 K7 U2 c) D; K; R* Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " F1 z+ a& U7 b2 D8 \6 B/ v
  55. #define STATIC_SHIFT                3
      U7 ^# {! ^0 o. Q* b# g0 }
  56. #define TCINTEN_SHIFT               20+ \+ H( v/ _9 G% g% \. i; I; X0 Y
  57. #define ITCINTEN_SHIFT              21
    2 l0 R% X* m( ]
  58. #define TCCHEN_SHIFT                22
    # k1 A, v4 a. g# U: V. i% T# h* u
  59. #define ITCCHEN_SHIFT               23* r7 Y+ I: ]: j! p
  60. ! t5 P. d! E( \; @8 ~
  61. static volatile int irqraised1 = 0;
    1 P7 J. ]" ^9 @; [" Y) h% @
  62. static volatile int irqraised2 = 0;
    ; s' Y  [% P5 z. q. e' p+ K

  63. , D- Q1 X3 D8 d! t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q' S  I9 R$ j. v4 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : D- k4 S& O" x7 U) K0 a5 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w9 ~$ l8 g' x% h" ]$ {+ Z; S2 Y
  67. / P3 g) q- L: k  a' l4 O! @" y- Q
  68. dma_addr_t dmaphyssrc1 = 0;
    ' {. }$ G+ i$ C
  69. dma_addr_t dmaphyssrc2 = 0;* w5 ?6 H" n5 X* W/ F6 I! |( N: a
  70. dma_addr_t dmaphysdest1 = 0;8 s* K& E& J3 `- N5 W
  71. dma_addr_t dmaphysdest2 = 0;
    : k* o* q# w6 G* P

  72. ' |" A# q9 a9 z- }3 N
  73. char *dmabufsrc1 = NULL;
    & B0 e, u0 z# Z8 `+ ]0 ?, u
  74. char *dmabufsrc2 = NULL;
    4 u0 }* Y3 \5 S3 s3 i( `% d
  75. char *dmabufdest1 = NULL;. k2 P. \; F$ g
  76. char *dmabufdest2 = NULL;
    0 g# q/ _8 {9 n$ x" V' a
  77. : d" z: Q' h' w2 N7 c. w. f! m% z  G
  78. static int acnt = 512;: k+ [% L5 O: `0 i
  79. static int bcnt = 8;
    . X! M) o1 i9 k* K3 T6 y' h
  80. static int ccnt = 8;
    % S6 E8 s% K5 A
  81.   q& _, s; \7 w3 @' ^1 g# ]( ^& o! {
  82. module_param(acnt, int, S_IRUGO);
    ; \/ v; L, ^$ b  Z3 _5 P' H
  83. module_param(bcnt, int, S_IRUGO);
    2 L' G# o+ l3 r- Q3 s- `. F" d0 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- {0 }' ^& O6 t) T- ~8 M( A
2 ^, Y" h' R) q6 [  j* ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! D+ D1 W+ ~: c6 s, n% ]' N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 |4 x' [1 e0 z' S( E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Q5 _: W$ ]7 l: O; s( T- g9 ]8 K1 e! N8 m0 Z0 A

" n! J, W! u" [; T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-3 04:02 , Processed in 0.039203 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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