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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 \7 t7 C! j0 Z% r; _
  1. [code]EDMA sample test application: D7 {# ~' r4 @
  2. /*
    * E. |; z2 E. g1 f5 l$ J
  3. * edma_test.c
    1 j1 X' x" {+ B5 i7 ^
  4. *
    3 Y2 R1 C2 K6 Z3 `
  5. * brief  EDMA3 Test Application
    ) h! r: `+ a' O' Q  V. u. Z
  6. *
    ; Z$ r" ~. _  B2 y' M7 h* U0 l
  7. *   This file contains EDMA3 Test code.
    5 O5 ?# E$ N0 z6 S
  8. *
    - o  A/ M+ i  }1 Q8 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " S8 i* U5 y0 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 Z- b) i- I- P, \8 o) b: r1 e2 N
  11. *         TO CHANGE.' M' h) ?& u5 @9 p  b7 o; ~
  12. *
    ' ^  K. e# U6 X: L& o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : Q: |8 ^8 U  K5 R' g9 Q
  14. *
    ; r- K  Y- T* v( g
  15. * This program is free software; you can redistribute it and/or3 \9 D7 Z' R! \# l- E9 B% Q% R
  16. * modify it under the terms of the GNU General Public License as4 L0 U0 g" T# \+ f- T  j* k
  17. * published by the Free Software Foundation version 2.! k0 d0 u6 u) Q) g: ?
  18. *
    5 A$ Y) g+ h# d/ a+ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c/ \. f4 H8 z/ ]
  20. * kind, whether express or implied; without even the implied warranty% l. {- s: Q, j, G6 k; t' h# z4 Y( J! J7 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - u6 r! w/ t+ a- B7 r6 B5 f
  22. * GNU General Public License for more details.
    , ]& x, ~/ v2 j* Q7 \
  23. */
    ( e. A* F2 _6 s* R+ b- O# g2 b
  24. 3 o1 _& ^) K8 ~7 c7 Z$ w+ V
  25. #include <linux/module.h>! r! r9 c( v' _$ b
  26. #include <linux/init.h>
    # J8 f: S# k7 z1 V% n* ~2 V# Q
  27. #include <linux/errno.h>
    ! A9 A, z. w' s- d- g+ ?
  28. #include <linux/types.h>- n! E1 s8 P" C$ C' b
  29. #include <linux/interrupt.h>
    ! R8 [3 s+ G. j/ l6 }, E4 q
  30. #include <asm/io.h>
      P2 p% U- {% f8 U$ f% ^
  31. #include <linux/moduleparam.h>
    # T5 u6 ]% _$ h$ ^0 @
  32. #include <linux/sysctl.h>) q9 q! t7 \+ _( u# Y$ [
  33. #include <linux/mm.h>
    " F  P# B/ s6 H4 f9 J
  34. #include <linux/dma-mapping.h>$ W1 @5 D5 ~+ q, e  D0 X& ?8 S3 P

  35. 1 @( B# M5 C0 d! `# N' d" D0 t. @
  36. #include <mach/memory.h>7 L  f9 S5 d5 [: M# `' M
  37. #include <mach/hardware.h>+ G' e- ]/ G; f$ L! I' b
  38. #include <mach/irqs.h>( [' x& u( d+ f; O
  39. #include <asm/hardware/edma.h>9 w! n- c  C- O" O

  40. 0 D5 \2 y# H5 x7 _  B
  41. #undef EDMA3_DEBUG4 q  i9 Q, p8 i( @2 U. Q4 z* }
  42. /*#define EDMA3_DEBUG*/
    2 ^* |" m2 |* R  K3 P6 `8 P
  43. 2 N1 v0 A0 Y5 n5 i9 a4 B
  44. #ifdef EDMA3_DEBUG8 N2 R( b0 s( ~3 f6 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ k  I- B8 d7 v4 F& B; e: B# @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ l* I5 Y) n- N" X6 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Y5 p" i6 Z  t. ^, T
  48. #else
    # g% n2 h* ]; h8 ^9 o
  49. #define DMA_PRINTK( x... )
    . J& g0 {' H* Z0 M5 E0 n' `& Z
  50. #define DMA_FN_IN
    + }& `8 {2 }: v3 d( H  S' d) Z
  51. #define DMA_FN_OUT% z" y$ P- _3 d6 t' S. Z+ Q
  52. #endif
    3 ?5 U( b7 i1 w0 |/ b7 Y$ v

  53. 6 I+ X3 H. g0 d5 Q5 M* c6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 x6 o8 A6 L& u4 d2 y
  55. #define STATIC_SHIFT                3+ p) ?3 @* v  t1 Y, v' K3 L% X" C
  56. #define TCINTEN_SHIFT               20
    3 R3 f" \& m/ t2 M
  57. #define ITCINTEN_SHIFT              216 n$ U/ D1 D: T- G! f7 S
  58. #define TCCHEN_SHIFT                22
    4 x. M$ Z  I  S6 O% o( T0 J$ F% X: Y
  59. #define ITCCHEN_SHIFT               23* Y' L) U+ V1 s/ Q: k& {0 D
  60. & `+ r9 p, C+ q9 e5 Z2 c
  61. static volatile int irqraised1 = 0;3 m; d, L; `/ V; f
  62. static volatile int irqraised2 = 0;) C; W+ B) _! H: N' s% Y2 e% O( A
  63. - ?+ h1 Q! V) h  Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H+ O; U: ?7 _: G; T! j7 |+ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c! C9 t7 F1 H0 t* y! x# J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S' e" a, |1 I! e, Q1 w1 o& X

  67. , f( X5 C' |  b
  68. dma_addr_t dmaphyssrc1 = 0;' ?% S6 R# |0 R1 x
  69. dma_addr_t dmaphyssrc2 = 0;9 s( }; t$ M/ _! Y' Q' z. W0 ^, s" w' m* S% Y
  70. dma_addr_t dmaphysdest1 = 0;
    / e$ I% n; D8 }5 r- @; P4 x+ E
  71. dma_addr_t dmaphysdest2 = 0;
    - R; A7 u9 U5 q: B6 b& o+ S: w$ R
  72. 4 p7 L8 P/ C' |5 N
  73. char *dmabufsrc1 = NULL;3 t, _6 Z5 p: {* ]
  74. char *dmabufsrc2 = NULL;
    - H. w5 \- R) B- A5 D6 g/ H' E; L
  75. char *dmabufdest1 = NULL;$ ^/ D: A& @, }
  76. char *dmabufdest2 = NULL;
    3 x0 }' R$ I) p/ Q

  77. " v" n; Q$ `8 j2 D/ m+ {  m8 G
  78. static int acnt = 512;
    & Y& h0 W4 `( A+ {
  79. static int bcnt = 8;
    7 @+ o  h0 b' y  g* ~; D
  80. static int ccnt = 8;" B6 w$ M" K5 @9 l

  81. $ s* p& L0 H3 I" F2 p$ a
  82. module_param(acnt, int, S_IRUGO);) L7 y! i% u* [- U1 Y- W
  83. module_param(bcnt, int, S_IRUGO);; t8 Z# p5 u/ @( }+ ~7 }- W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 R& o3 ~( D& q: o# U/ Y. h$ t
) Y' J2 a0 l! x$ o, h+ U; [% j) p& {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  {- `/ C1 S) e, ^
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 ]3 I. y9 d  T# w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U& g1 ]2 w# S8 ]) t; G. t, B  j1 }- U/ ]+ E8 O8 r9 y7 B5 }

' N/ v& z- G1 |* r; f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 03:02 , Processed in 0.041467 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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