OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' h7 o: ^- E! v% N- B5 S
  1. [code]EDMA sample test application" E0 @6 K0 k7 d# [6 z# O
  2. /*
    6 I; n3 Z7 I& N( Z9 N( B  O
  3. * edma_test.c
    , m* h$ E' n/ B0 ^( s
  4. *
      J6 }, V- O# ]! `
  5. * brief  EDMA3 Test Application; q: f5 I# b, F
  6. *, I; O5 F- b, R, }# m3 S% Z/ b! g
  7. *   This file contains EDMA3 Test code.
    ) C5 ~4 p8 v* C! j! e
  8. *- i% x; ^# `" V6 h% X+ i& m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) |8 a; V# A5 b7 G5 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 @0 w+ y# v4 d8 m( D
  11. *         TO CHANGE.
    / @- ?) h0 W, |/ n6 j3 L9 O$ d
  12. *
    - z- X$ P) U+ O& G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 K7 n* J1 s  C" T( W- Z' A% V
  14. *
    - N6 w: @% d  u
  15. * This program is free software; you can redistribute it and/or
    6 t: H% X4 u& C3 O( ]" W+ i
  16. * modify it under the terms of the GNU General Public License as
    ' C8 j/ G$ \4 m1 X4 u* g5 k5 y
  17. * published by the Free Software Foundation version 2.$ S2 |7 }/ V$ ~* s. ]
  18. *
    ; M( ^5 P% |' E0 [' J8 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 j& Q+ J8 ?9 o4 u- _  @
  20. * kind, whether express or implied; without even the implied warranty+ L* J- y% J* S2 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 u' d+ P& h1 v! D- _& p
  22. * GNU General Public License for more details.1 K6 r+ Z" `3 J, [7 b+ Z
  23. */
    . ~6 y  ?  h5 O2 k9 `, A

  24. - R- O% o* Q7 U% G. n! D4 M. u9 f
  25. #include <linux/module.h>* J- H7 B7 [# j, I1 Y
  26. #include <linux/init.h>
    0 t- I9 k! d. f8 a, _4 r, Z
  27. #include <linux/errno.h>
    ) x' t; J  @/ h# d
  28. #include <linux/types.h>
    ( [: T' @! h7 @% O# E6 r
  29. #include <linux/interrupt.h>
    7 e- M. }+ x$ S* s- [  K
  30. #include <asm/io.h>! n' U5 \' }& a0 d! k& O0 ]+ v! X
  31. #include <linux/moduleparam.h>
      r+ I) J/ ~; R# q
  32. #include <linux/sysctl.h>7 `) `% _0 U5 b3 [& L) w
  33. #include <linux/mm.h>2 G& G/ `: M+ k9 G# P
  34. #include <linux/dma-mapping.h>
    " [& D  B2 M. s* g4 \

  35. ; {6 s7 r! ?1 {
  36. #include <mach/memory.h>
    8 t! F/ u2 p5 \7 w1 `. |9 @
  37. #include <mach/hardware.h>' e( u# \9 C+ l: R6 I, {: f9 x- ^7 c( P
  38. #include <mach/irqs.h>
    9 H: y& z( i+ F/ r' v5 s9 e
  39. #include <asm/hardware/edma.h>2 `: k( o: G  \( r! C( \0 p& F

  40. 1 t7 ~* K/ W8 v" G8 [
  41. #undef EDMA3_DEBUG3 U; w; J. K( W* r. C
  42. /*#define EDMA3_DEBUG*/
    ! [$ B0 x& S( L

  43. ( ?3 c* a, s0 v  p4 o$ u1 b
  44. #ifdef EDMA3_DEBUG' x1 u$ S) I% u) U2 ]" E3 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' p3 u4 O( [* X4 ?1 T" y$ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' l2 [3 ~+ k; C( z% f) f- S% V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U3 l1 x  I; l1 Z' |( s
  48. #else
    5 _& t  ?" O( H0 r0 R* K# M
  49. #define DMA_PRINTK( x... )$ F8 e6 a; Q2 y3 ~' ]8 Z
  50. #define DMA_FN_IN- f0 d5 b$ J7 I1 p. v" T
  51. #define DMA_FN_OUT# y$ r3 ]: ^) z2 ]' @' |0 f
  52. #endif+ G! f& X" X3 _9 K: U, B" A

  53. 3 G( f9 x3 `- x+ h7 c7 E& U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( x5 P- P4 }% N  B
  55. #define STATIC_SHIFT                3
    4 Z. J" c) A$ ?* H( q2 o
  56. #define TCINTEN_SHIFT               20
    & ^2 ~. _) U# E
  57. #define ITCINTEN_SHIFT              219 o9 J9 m9 N/ i& z
  58. #define TCCHEN_SHIFT                22
    $ W. v: H& A2 U
  59. #define ITCCHEN_SHIFT               231 ]  s) F  _5 a
  60. 7 Y& x/ r0 y7 Y6 [& _8 p
  61. static volatile int irqraised1 = 0;4 ~6 y6 O5 H! }) Y6 e4 ^/ |
  62. static volatile int irqraised2 = 0;
    " p+ L" X6 k$ W1 z! J7 w
  63. ( R+ e* |5 O( W1 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 y" w4 Y1 H$ j  y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - l, P- p. F# B2 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & x' C0 v5 v+ E
  67. ' R; u7 `: I& ~( x, J
  68. dma_addr_t dmaphyssrc1 = 0;- N  y# Q8 z2 d4 S. `
  69. dma_addr_t dmaphyssrc2 = 0;
    " F+ G6 l! j+ b# C
  70. dma_addr_t dmaphysdest1 = 0;
    5 v/ d4 z$ ]% q, C- J( X
  71. dma_addr_t dmaphysdest2 = 0;/ L' w) |8 K8 P
  72. 9 H- m5 W2 i/ D( l5 n0 E% B# b5 o
  73. char *dmabufsrc1 = NULL;1 q/ h) ~8 B( N/ |6 k( C/ n1 n
  74. char *dmabufsrc2 = NULL;) D$ U0 L! g$ b) {! Q0 ~% m7 D; e8 P
  75. char *dmabufdest1 = NULL;! y8 G3 d  ~5 C* K1 A# r
  76. char *dmabufdest2 = NULL;2 r  z+ C. w7 q
  77. ! J. \3 Z* Y. u0 \6 ^  e
  78. static int acnt = 512;
    ) e) B3 B; i7 C; f$ E
  79. static int bcnt = 8;
    , a1 l/ `; n4 l2 S: h: u& Z8 k3 r
  80. static int ccnt = 8;, h) l0 k8 x8 O4 y( H) ^$ q
  81. 8 L5 l4 J8 A5 Q( q2 j
  82. module_param(acnt, int, S_IRUGO);
    $ b/ l# I) G( k6 z% w
  83. module_param(bcnt, int, S_IRUGO);
    4 _/ C7 Z: `6 F  J% S( r1 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 k% ?9 x8 F; L9 j% @! |4 a; @
/ s$ T! {' n) E( u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 H. i! ]& L' e9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]# ]3 r4 p3 a6 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 d# U+ }  F3 \, _
4 v( _" H( I( {: a. n

5 W" @3 b0 e$ |7 P3 S: _( q2 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-4 17:38 , Processed in 0.035715 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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