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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; J0 C- i2 h( T/ m6 h
  1. [code]EDMA sample test application+ r, u8 I5 M$ V2 `8 l
  2. /*& J8 f* H0 w) K# u5 I# Y
  3. * edma_test.c: X- F7 @3 }0 w5 b  u7 L
  4. *
    : k& _& d2 [; Y" S% b8 x; q/ t
  5. * brief  EDMA3 Test Application
    1 S& P( V, |1 ]
  6. *
    ) C6 h" }4 D+ Q: I
  7. *   This file contains EDMA3 Test code.& f& z2 F! ^, H
  8. *3 R$ ?0 p! D  g  b( V! T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v) t! w1 j6 j# c" g2 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 N! g. F( D  R; |
  11. *         TO CHANGE.
    / ?. C1 V* f9 T% D* O
  12. *6 H6 e  d% Z+ C6 H% I5 n7 V5 V/ ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; O$ P7 j8 A8 [2 r
  14. *
    / U2 l7 w5 j6 E$ E+ A8 e- L
  15. * This program is free software; you can redistribute it and/or" A4 }. k$ k- y& c: D0 u0 f1 P
  16. * modify it under the terms of the GNU General Public License as
    - j( w( c3 Q( E1 {- V$ D- C7 a
  17. * published by the Free Software Foundation version 2.
    3 i; |  j9 z$ [, f/ P. S$ x' y
  18. *9 M! M3 l; q+ `: _5 L3 m' d- i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 k0 H/ X9 x0 p6 b+ B* p5 Z' V
  20. * kind, whether express or implied; without even the implied warranty
    8 V9 j* z& E1 }) T% m$ G! c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# o% Z8 W+ |! R
  22. * GNU General Public License for more details.
    4 B' j2 y( i$ C, v
  23. */3 f3 _# m) o! o1 i; V% t, V2 p
  24. : F( G3 L2 X" P6 O4 y$ p
  25. #include <linux/module.h>
    2 \+ w0 Y' ~  M6 ?4 z( F
  26. #include <linux/init.h>
    7 k# c( c+ |/ U' [$ f0 e
  27. #include <linux/errno.h>
    % b8 D* F# l! B9 K2 e1 \- Q, \
  28. #include <linux/types.h>3 O0 }) i4 [8 W& x
  29. #include <linux/interrupt.h>
    : v, C, ~% I1 Q2 G2 q
  30. #include <asm/io.h>
    4 F9 c8 c' }+ _2 P
  31. #include <linux/moduleparam.h>- S  w) N, }/ F9 g3 Y- Q
  32. #include <linux/sysctl.h>
    . Y4 `! \; N7 m
  33. #include <linux/mm.h>
    8 q- o8 E! {- K4 z  E& A
  34. #include <linux/dma-mapping.h>
    . W  g1 U5 d* Q6 t
  35. . Y6 H$ w: J, R! |6 T& i+ Y3 G
  36. #include <mach/memory.h>, }6 G1 M( E0 @- j( ~& d
  37. #include <mach/hardware.h># l; ]: k4 K5 r$ T
  38. #include <mach/irqs.h>
    & C# ?  s0 {/ x& [$ E/ r
  39. #include <asm/hardware/edma.h>7 r* w) k2 y/ @

  40. " q7 {) j, e5 q$ l
  41. #undef EDMA3_DEBUG$ Z- ]5 V/ q4 |5 G& z& F9 f8 ]
  42. /*#define EDMA3_DEBUG*/: n: U- L5 B; X7 V% e( y! m

  43. 0 G# Y; e" F3 b/ L$ A
  44. #ifdef EDMA3_DEBUG: V4 l9 X4 b: Z# O. i2 r7 C) v, `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " }. a. h- |: I7 M! X; @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      r$ ?5 E7 i4 S6 K0 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 E- t( t. G" o# x
  48. #else% I) o9 q4 F5 y( i0 f& H
  49. #define DMA_PRINTK( x... )4 D) P6 [1 G$ j4 y- A, G
  50. #define DMA_FN_IN
    2 v- f! q( h8 W" K% }6 s
  51. #define DMA_FN_OUT6 K) k  ^8 \+ w
  52. #endif. G" r' l- G- h( I2 o4 d! K
  53. 6 h* i: j: p! z" o2 e5 c; P7 @6 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 g% j# D2 u' z4 b
  55. #define STATIC_SHIFT                3( }8 ]6 T! n9 j. w6 B3 j; w8 C# b
  56. #define TCINTEN_SHIFT               20' O5 H4 y% j0 ]" G; b
  57. #define ITCINTEN_SHIFT              21
    7 b( q, v1 }0 k( r# a
  58. #define TCCHEN_SHIFT                221 a; B; r- r  H& `; I; g& ^! u
  59. #define ITCCHEN_SHIFT               23
    , u- k! x: `- {5 ~) M3 D7 _- o
  60. 7 D7 A1 L( c$ H5 N$ G4 B8 l9 \
  61. static volatile int irqraised1 = 0;
    ( P1 g9 `2 j7 f, x
  62. static volatile int irqraised2 = 0;
    ( d3 l; p) b7 I, R

  63. / ]$ W2 C7 K7 L  z, U, M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 G! x0 y9 K5 h) ^& Q9 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {* r1 R1 z" U: e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: }+ V% L* w5 b9 e) U) h9 t, e  h/ q" T
  67. ' c+ D' t2 W; S. U( V; H1 T
  68. dma_addr_t dmaphyssrc1 = 0;
    1 P5 a5 d; j$ y
  69. dma_addr_t dmaphyssrc2 = 0;6 X  z$ t+ V# G( i
  70. dma_addr_t dmaphysdest1 = 0;' b' n4 |3 q3 b
  71. dma_addr_t dmaphysdest2 = 0;
    3 w$ D/ S/ c6 T
  72. 6 |9 _! y' K2 {4 c
  73. char *dmabufsrc1 = NULL;5 c: p+ M& Y+ V' k
  74. char *dmabufsrc2 = NULL;' I7 ^5 z  n; q  B+ l
  75. char *dmabufdest1 = NULL;
    4 f2 S- v6 D; h( k* }( _, M
  76. char *dmabufdest2 = NULL;8 c6 X. c/ d' D4 H# g
  77. + S/ l  A5 `5 K& f9 I' D9 H
  78. static int acnt = 512;
    " T" L2 s8 u/ J$ h+ A7 q' Y
  79. static int bcnt = 8;1 \2 c. I' l, K4 ~0 s
  80. static int ccnt = 8;
    1 T% X9 \. B5 A( Y6 ?

  81. 0 ~: n2 d1 {4 {6 ?
  82. module_param(acnt, int, S_IRUGO);, N% d% V9 A6 C
  83. module_param(bcnt, int, S_IRUGO);* b/ v6 w. X2 r7 L2 K1 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, C8 o% f" t# j. h+ w/ o: g5 o: a2 I9 W+ W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: R% `! f, ?4 `7 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& q3 @' [' Y% O+ F% a0 U5 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- J$ _/ K7 V5 }$ }
* _0 G0 o; |3 `6 _
5 w0 g* k) W5 @: _" s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 09:13 , Processed in 0.042113 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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