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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Y( H3 n# Q. w$ R4 I  W5 k
  1. [code]EDMA sample test application5 D. B* C8 V1 D4 a& f0 Y
  2. /*9 {: M% F0 v: {- h, T9 R7 z
  3. * edma_test.c
    . Y0 ?4 U4 W# @) y1 r
  4. *# w5 y! A4 C) T/ a7 W
  5. * brief  EDMA3 Test Application' X" i1 @: l; J; u4 d1 P+ I
  6. *
    & q# B. S) U. k2 d5 k
  7. *   This file contains EDMA3 Test code.& T$ R( D% |, Z' f  U1 Q5 d
  8. *
    / U1 j* o' h& @0 J3 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 P; i# K9 k7 G+ D. ^/ k5 f' W6 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + l1 p+ x! M( W4 T( f4 }
  11. *         TO CHANGE.+ ?5 k1 v! B: Z& P
  12. *
    - z( ]+ ?+ j# d; _9 H; @# z6 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m, m$ |' c* z
  14. *3 C! e1 c6 u; R& l% {  [) m
  15. * This program is free software; you can redistribute it and/or
    ; ]- a! e) S$ X, M
  16. * modify it under the terms of the GNU General Public License as0 ?- H- q8 E. R
  17. * published by the Free Software Foundation version 2.
    2 t: I+ t8 @: f& j& C
  18. *; i! ^$ C% [! a+ u, }- Y& ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % G7 I1 `5 Z$ p, }; D5 [4 o
  20. * kind, whether express or implied; without even the implied warranty$ V; t! z% r' g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( A$ O) y: V" y. o3 \1 }4 C8 D
  22. * GNU General Public License for more details.
    2 i- f" O$ [/ H  Q& e
  23. */
    1 H; E$ W5 l6 E1 |; O

  24.   Y' q4 ]. d; m" k/ Y' ]! E: c
  25. #include <linux/module.h>
    ' M- @# A/ K5 T' O
  26. #include <linux/init.h>  e( F4 T+ ~' z; P
  27. #include <linux/errno.h>5 Q2 n; R& Y" ^. p6 D9 S
  28. #include <linux/types.h>( G8 W! q: i( h, ~8 r+ k
  29. #include <linux/interrupt.h>- T* _5 q$ `1 ^' N2 A3 S1 s9 C( j
  30. #include <asm/io.h>9 C8 I1 t. p! V6 N( W
  31. #include <linux/moduleparam.h># z8 {& f$ @+ }! g. g
  32. #include <linux/sysctl.h>
    # i: V# i1 u1 b* U
  33. #include <linux/mm.h>* y3 u+ Y# z) ^% f1 r. y& P
  34. #include <linux/dma-mapping.h>* I  k$ U+ [: U" j5 p

  35. 2 D# r3 q, [, q3 C+ f
  36. #include <mach/memory.h>. I( G. r* o, C) A8 \+ h
  37. #include <mach/hardware.h>7 i! s2 O. O0 m
  38. #include <mach/irqs.h>, S& i! |: E0 [; A& X
  39. #include <asm/hardware/edma.h>2 X: E* o3 R' u1 Q4 \6 h3 r  a" L

  40. , G! a7 M6 z5 K( z) @$ r7 A' \
  41. #undef EDMA3_DEBUG
    . a7 F$ v" R4 O; h3 B4 e
  42. /*#define EDMA3_DEBUG*/
    1 P6 a0 H- ?* c) S' A. _; z$ y
  43. ( I# p& C' r$ z$ E
  44. #ifdef EDMA3_DEBUG6 d! N7 b. P. t1 B4 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' P9 n) h3 g8 q$ v7 }1 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 s4 j6 R+ ]# J5 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ?& B- P' M  S, U' R, _$ g
  48. #else
    - i$ V4 ?. r2 f* ?' `& j
  49. #define DMA_PRINTK( x... )
    : W/ v) I* d8 j' `
  50. #define DMA_FN_IN
    6 M/ P# i% ~- i0 b4 G' x+ ^
  51. #define DMA_FN_OUT
    : N% F: S7 \9 L0 @/ c' z2 x
  52. #endif
    9 V+ `6 }% W& C' X  q5 G

  53. % ^4 i* B" V' \, _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 a& ]  L, L5 h1 r8 @! l
  55. #define STATIC_SHIFT                3% R0 \/ Z2 [% V
  56. #define TCINTEN_SHIFT               202 `6 J: f0 v/ Q
  57. #define ITCINTEN_SHIFT              21: n+ ]8 e. L8 e9 l' z9 B, u  M
  58. #define TCCHEN_SHIFT                22
    & O  m7 X0 h- j) `' @- o- U
  59. #define ITCCHEN_SHIFT               23/ }+ ^' _! t* _2 f$ s$ d

  60. 1 ?; u8 n: e7 ]4 q7 W" W8 J
  61. static volatile int irqraised1 = 0;9 r. l  L# d$ Z1 n
  62. static volatile int irqraised2 = 0;( `: V; e$ q0 `+ t8 j2 U2 w% p! m

  63. 6 V' U) M+ ?- U9 ^! p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      a: l3 u7 M$ i4 e7 w; h' O5 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k, K7 Z% W5 C+ J7 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O2 J: \) N" k5 p. V6 }) o

  67. - o1 @* ~. I. W, I1 J$ I
  68. dma_addr_t dmaphyssrc1 = 0;
    # f2 ~7 q& x4 D1 S
  69. dma_addr_t dmaphyssrc2 = 0;7 t+ I! J' }; l3 b
  70. dma_addr_t dmaphysdest1 = 0;
    % C  t# H* k3 j2 u2 d
  71. dma_addr_t dmaphysdest2 = 0;
    & A3 y4 P- a- V1 A
  72. ; a( v" @# n5 Q! q8 U& ?; U: d) n
  73. char *dmabufsrc1 = NULL;" O2 N3 o  z; g
  74. char *dmabufsrc2 = NULL;
    & q, u& z6 a& m. L! V; L
  75. char *dmabufdest1 = NULL;9 W2 J% m: B' m  ]; ]# Z7 X
  76. char *dmabufdest2 = NULL;' v. F" H- f5 n5 E8 w

  77. ) y4 V9 n8 o$ C. A8 M/ w' _
  78. static int acnt = 512;
    + J' G5 G# i4 z& O) d. u
  79. static int bcnt = 8;
    2 F# s# b1 C9 O0 [* S0 k
  80. static int ccnt = 8;
    * S# z* e* H; \; U0 _9 {

  81. ; L# h$ k, A: H# M8 e
  82. module_param(acnt, int, S_IRUGO);, n+ a9 g( D$ X2 x* m$ a
  83. module_param(bcnt, int, S_IRUGO);
    ! N2 l! S! s0 ^& y( @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 z8 m$ z# [6 V1 N
5 r+ i: t- k; d$ l( x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) `0 [$ U3 P5 i! J0 E' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ]. n# F0 z& I) _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# `2 p0 [) M# r$ o  L5 V. V3 Y- e9 U' q. J( w

; r( ]" ?3 ]7 E9 U9 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-6 06:26 , Processed in 0.045672 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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