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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N* E/ |$ l7 Q
  1. [code]EDMA sample test application
    8 M/ ?% {* K4 O4 N9 R
  2. /*
    ( K) f1 B! w2 d+ g! }$ B5 T/ @: t
  3. * edma_test.c9 I0 T5 I: ~6 F2 p. P5 f3 {
  4. *- K- [7 Q2 m  |
  5. * brief  EDMA3 Test Application
    9 ^4 c% ]* I" ]1 R1 b
  6. *! _% Q9 W6 j- I! |
  7. *   This file contains EDMA3 Test code.2 X) |0 ~( b6 ~, R& i$ b
  8. *" M$ r2 e- `: L& }  m" I& }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ]+ K3 j& d0 j1 y/ T& G+ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. X" v- R, W9 E
  11. *         TO CHANGE.
    # J# E: N' d& f
  12. *
    4 ~% y- T3 e% ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # u( v7 u& i% u, x! U- }$ a- K; y
  14. *( Z0 |7 J$ ^+ g9 X
  15. * This program is free software; you can redistribute it and/or
    $ j/ o& E; U; R# Y
  16. * modify it under the terms of the GNU General Public License as/ ^5 |1 u9 L2 A! a2 r
  17. * published by the Free Software Foundation version 2.: @0 G# k( e) e; g  G
  18. *
    * F3 V' |/ i# q* M  w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 k! R0 M3 `, g, O3 U4 f
  20. * kind, whether express or implied; without even the implied warranty
    * d+ ~+ Z, `+ K- W# @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, |" Y* [; a( s6 ^; i6 B5 A
  22. * GNU General Public License for more details.$ c* E" l  k  F) x1 \* C& F# _
  23. */5 o( o1 X" {" I) x. t
  24. + K% r1 |( H! t" F! ^# M* Z
  25. #include <linux/module.h>
    9 G5 U. v0 V# e0 W- A
  26. #include <linux/init.h>0 _, a9 d: d( R/ G
  27. #include <linux/errno.h>
    3 E8 [* l- I$ }' c
  28. #include <linux/types.h>! r$ C9 I4 r) [! o( H
  29. #include <linux/interrupt.h>
    : s7 i' L: \  e5 H5 O3 {4 M
  30. #include <asm/io.h>
    , N: A1 r0 E, i, e1 v6 S) t  B& f
  31. #include <linux/moduleparam.h>
    8 J/ |" l& H; ~) m/ _( Y0 I
  32. #include <linux/sysctl.h>
    . z1 a; N- J2 U* I7 a
  33. #include <linux/mm.h>: N2 \2 J( ^6 B# ~
  34. #include <linux/dma-mapping.h>$ j5 `- M( X5 L4 ]5 k
  35. 5 y( `" ]+ @% O, W; ~
  36. #include <mach/memory.h>3 w1 t' g" K6 s) L% e
  37. #include <mach/hardware.h>2 t  P$ ]7 b3 F4 o% V$ @
  38. #include <mach/irqs.h>
    , L: j4 m6 N: @8 @/ I* y0 J, G! b
  39. #include <asm/hardware/edma.h>, K. w1 \7 M! i9 [  k
  40. & W) {! p! M- ]. V$ j. @( y
  41. #undef EDMA3_DEBUG. g- c( U* V) j) B$ s4 |
  42. /*#define EDMA3_DEBUG*/
    2 b0 I% ]0 W3 w3 A/ L
  43. 4 M, d, S; Z4 Z, W' R& @( ~
  44. #ifdef EDMA3_DEBUG
    3 q( ^0 }8 N) X- Q8 u% K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 n9 X: m0 y0 N+ }( p% \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @4 G' z: C6 w3 J8 W3 Z, ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # |9 V5 t5 V, ?' G) r0 f
  48. #else7 h1 w3 T( @/ p" U
  49. #define DMA_PRINTK( x... )
    0 X- W9 ?6 w) n8 g
  50. #define DMA_FN_IN
      x0 _& `4 l" \: C7 L
  51. #define DMA_FN_OUT+ J$ y% M- ?3 l
  52. #endif
    3 q( j6 ~) @& E1 N& L

  53. 5 s3 b# h4 b7 y; E# n3 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 j4 C- \; {4 P* @* r) S
  55. #define STATIC_SHIFT                3+ I1 j5 D- b& T( W
  56. #define TCINTEN_SHIFT               20
    9 R2 |& X: Y0 M+ c  G; R7 \
  57. #define ITCINTEN_SHIFT              21' T- {6 f6 G% R1 j/ y# y# c
  58. #define TCCHEN_SHIFT                222 V# |# X3 ]- I7 c# f. x: b) ~9 x6 l
  59. #define ITCCHEN_SHIFT               23
    ' E. x0 ^1 e9 v1 e  p9 W

  60. 7 o" t: b$ _- J
  61. static volatile int irqraised1 = 0;# d) _# b; r# [) _+ Y
  62. static volatile int irqraised2 = 0;: i# o. p! |+ w# T5 Y

  63. ) f, R3 O4 I. ]! R# y6 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i6 h1 _$ I, o+ Y7 Y3 M# e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R; _1 Z/ l3 W0 w  p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l* x3 S) h+ r+ C& Z
  67. 4 t6 w. a1 d% z. j! m  ~9 L9 ]
  68. dma_addr_t dmaphyssrc1 = 0;' s2 W* U1 v7 H: V, D
  69. dma_addr_t dmaphyssrc2 = 0;4 L! e1 G* y1 T0 u8 Q9 T% M
  70. dma_addr_t dmaphysdest1 = 0;4 T! x4 S: z( i, W2 n
  71. dma_addr_t dmaphysdest2 = 0;
    $ K, H; ?, P1 u5 ?7 N

  72. ! w) N! t1 W& |- u
  73. char *dmabufsrc1 = NULL;( W$ q7 N, {3 ]% N" c
  74. char *dmabufsrc2 = NULL;* L, V6 T5 d" a# j
  75. char *dmabufdest1 = NULL;' W$ M, H% H& Z! h' R% K" g0 b
  76. char *dmabufdest2 = NULL;
    3 [$ _/ v; t) o6 ^; o: b2 ~
  77. + d& n; s3 v2 ^4 k0 B8 W
  78. static int acnt = 512;( }; ~8 D9 r5 B; X
  79. static int bcnt = 8;" j# E: b) J8 {) q4 Z; P
  80. static int ccnt = 8;  i, w# ]& H6 E& d3 J! R; p& z* o
  81. : o0 k3 O/ r( ?8 o, Z' {
  82. module_param(acnt, int, S_IRUGO);
    ) _" c# Y( z$ u$ d5 O/ |- ~  |: J7 T
  83. module_param(bcnt, int, S_IRUGO);2 r- i, A. p" ]( A) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  Z; R& u2 J* Q9 g3 Z
( g8 U7 T$ S" D) x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& g0 N- a0 i) l) }, K6 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; d. h+ V& F$ w9 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q6 m6 m. ~2 s- M1 F5 K4 K  Q7 L9 h( N! l3 Z5 @* y: |; a

3 a2 O+ e/ Y/ J; c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 15:33 , Processed in 0.040154 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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