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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   q& l) _4 P6 v! i& J
  1. [code]EDMA sample test application
    6 k) e3 H! D) m. R9 f$ t( [$ b
  2. /*. ^9 k' Y& N3 S) X0 R, e0 j$ j
  3. * edma_test.c8 _7 O% @) x& U8 G  [3 [6 s: z
  4. *% F0 j2 p; @6 w+ c
  5. * brief  EDMA3 Test Application4 E* C# B$ l4 T9 X! W$ I, C
  6. */ ^0 W% w) B) p% A% I
  7. *   This file contains EDMA3 Test code.0 d* i# B" N2 m$ m
  8. *! Z% C& {; G  l4 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) h: D. N$ K$ `7 C# ~- z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 a) y8 J! E, h  Z6 b5 R* u
  11. *         TO CHANGE.
    6 y( K( B& o5 Z
  12. *
    ) @  S! N5 B* I  l! c! I8 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 m- T7 n$ \& A0 R/ f
  14. *9 p2 s, R8 p; r+ p  Q1 J" f+ k
  15. * This program is free software; you can redistribute it and/or7 B* @. Y1 s; W' m
  16. * modify it under the terms of the GNU General Public License as
    0 K- S0 o- f, v" z( g
  17. * published by the Free Software Foundation version 2.3 c! v( G% Q( V, \8 A, |
  18. *
    - V# k8 P, o, C1 m0 y% P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, e" a+ r, D! R! R8 p
  20. * kind, whether express or implied; without even the implied warranty
    4 z7 x3 Z' {6 M/ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 }/ W6 P$ B$ [! [
  22. * GNU General Public License for more details.
      i7 P5 O# s5 y4 s7 M# h
  23. *// |! K8 ^, f' Y5 Q4 `
  24.   l/ W& z4 u/ g  Y; b) ~
  25. #include <linux/module.h>
    + x% ?6 r* V0 ~/ @. _/ E
  26. #include <linux/init.h># c6 i3 _" A) [- n" N* M7 G
  27. #include <linux/errno.h>+ {' I& h  P5 D- D) V. ~6 @
  28. #include <linux/types.h>
    $ d* O3 Q! y5 m, z+ i4 q) ^) \
  29. #include <linux/interrupt.h>
    8 z& G# e% v. N: B( ]5 K* Y
  30. #include <asm/io.h>* U7 F* r  o0 P
  31. #include <linux/moduleparam.h>( u; S2 g5 v$ `
  32. #include <linux/sysctl.h>
    - O, ^! y$ K2 I5 V$ J
  33. #include <linux/mm.h>* p0 I( p( _6 ^- h' c- I% H7 ^, y
  34. #include <linux/dma-mapping.h>1 c- p3 @$ r' B
  35. * |* l2 P8 G9 t  e5 {# f
  36. #include <mach/memory.h>5 v. _! O7 M& V+ s% H
  37. #include <mach/hardware.h>: [0 C1 m& l/ ^9 W. F
  38. #include <mach/irqs.h>, G, e- \5 v2 |9 S
  39. #include <asm/hardware/edma.h>
    : }! r3 D, D- A. \. U8 n' Q* h

  40. 1 @8 w0 @$ t6 h$ ]3 {  V$ X
  41. #undef EDMA3_DEBUG6 h$ }# S  [! Y  q
  42. /*#define EDMA3_DEBUG*/$ t3 i. h% ]0 M, Y- W  h

  43. - n/ s) x! }  e0 V
  44. #ifdef EDMA3_DEBUG) i# l( k/ `* D3 ?* j# s) p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : `, r! ]$ p  ~7 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ |; \" |2 F" Z( n* K7 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + e! w% L/ i# A# R; ?
  48. #else
    . Q  s) t" l9 e
  49. #define DMA_PRINTK( x... )
    + h- k% d, U* K3 ^: z+ P
  50. #define DMA_FN_IN7 x' x/ l1 s2 f& G; {
  51. #define DMA_FN_OUT5 r7 _; a2 [3 k* E" j; P1 P
  52. #endif; E% y4 v/ y: V5 z+ R. T* [
  53. ' S/ [, e! H. `" u3 o) @, I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! T& U( L  U- t/ }" V: u5 O4 f5 U! E
  55. #define STATIC_SHIFT                3
    1 g6 a, V. Z2 h7 D! P) e& I
  56. #define TCINTEN_SHIFT               202 L5 R. m: P) J: `
  57. #define ITCINTEN_SHIFT              21! r6 M; d5 m5 F6 x+ P$ s
  58. #define TCCHEN_SHIFT                22
    ; M  d( F. _1 }6 j; i' b
  59. #define ITCCHEN_SHIFT               23* j* s+ U1 t, k+ u  C, H+ d

  60. ( _+ x) s4 f8 B$ u/ l
  61. static volatile int irqraised1 = 0;& K5 {5 g5 j% ]9 d
  62. static volatile int irqraised2 = 0;
    7 }) {" H; o! F! O
  63. $ L! i' |& C0 f6 K3 a, o- E! w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * e+ K+ y1 ^/ y8 N3 Y! |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; E! y& H& ~4 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Z5 K7 v* t, d! ~* P! G
  67. + S. B% ]" M  T1 }% V
  68. dma_addr_t dmaphyssrc1 = 0;
    4 H& `! u. n6 @0 X+ Q- N+ z
  69. dma_addr_t dmaphyssrc2 = 0;5 I1 d! e2 `* R( e1 s
  70. dma_addr_t dmaphysdest1 = 0;! d/ o( G( }) H
  71. dma_addr_t dmaphysdest2 = 0;$ f& p3 b: N8 R) j/ q3 S
  72. : d- Z% o0 m1 h$ L) w
  73. char *dmabufsrc1 = NULL;( G5 A4 z1 P  q2 @
  74. char *dmabufsrc2 = NULL;/ Q( I+ h1 i( y
  75. char *dmabufdest1 = NULL;: U! B! O. d) y# A# C
  76. char *dmabufdest2 = NULL;8 z  [2 E: z  J# g
  77. ! ~3 `0 G/ Q* ^- ~9 N/ ^! r$ t
  78. static int acnt = 512;/ O4 }( X# T4 S5 v: }. X
  79. static int bcnt = 8;6 {/ |& M! ]: ?' T  g9 g( ?1 L
  80. static int ccnt = 8;
    ; z, V' c/ x' ]

  81. 3 {8 [/ y1 P; p- U+ ^' D. u
  82. module_param(acnt, int, S_IRUGO);. z5 u" g; m. K, r, `
  83. module_param(bcnt, int, S_IRUGO);
    5 I1 c3 k' t7 L! Z" |7 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" i7 P* J  L9 M4 _  M7 r# W9 J" T8 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. N" K6 }# K. z0 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& B! k& g5 L" t( j+ Z0 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ?0 ?: I) ?* }4 j5 F3 W
4 h4 X. u8 y3 h2 z& ]- L
0 r! @: R) r& R  E# h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-30 17:45 , Processed in 0.045521 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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