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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: T! M8 Z* e+ p$ s, J: v
  1. [code]EDMA sample test application7 Q  g7 F7 ^2 l
  2. /*6 r/ Z1 u0 @  H5 C9 F
  3. * edma_test.c9 j. Y6 N4 M/ S/ x# d7 ?6 o
  4. *8 N* l; d/ ^2 A- m
  5. * brief  EDMA3 Test Application
    3 Z- M4 I- R' |$ A3 W
  6. *
    ; e: `" Z2 c% p4 I: u& }% ]
  7. *   This file contains EDMA3 Test code.) k7 c, A: c0 Z/ {$ a( q  b
  8. ** m+ Z, b$ x. x, E9 X% V) _3 J) ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! @) @- i4 p+ [# k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 e2 i) j7 t; w
  11. *         TO CHANGE.
    - K2 I3 B  R' g/ Q0 z
  12. *2 B: w5 T+ M/ \7 ]4 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! q, ?6 o6 W) c
  14. *
    + L4 i# c/ H% y# N# e$ J
  15. * This program is free software; you can redistribute it and/or! k# w$ R0 {! R
  16. * modify it under the terms of the GNU General Public License as
    - Q7 t1 s4 C2 `; D
  17. * published by the Free Software Foundation version 2.- k. `2 a- T0 s3 B" A+ q
  18. *' {1 r. ?% ^& E; B4 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ T# Z& |1 \' V+ U1 N7 y9 }1 e
  20. * kind, whether express or implied; without even the implied warranty, ]" ^( k5 V+ _( ?7 Q6 H  ^3 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ Z5 g' l2 Y4 h  h
  22. * GNU General Public License for more details.* x0 b: Z' w. r( J
  23. */2 K( q- Q- W3 h' p+ r% F5 m

  24. 7 P# C' W2 L) ^4 w9 M
  25. #include <linux/module.h>% R2 o3 H9 M" h/ e
  26. #include <linux/init.h>
    0 |- G# F# T2 U2 E* w* a. s
  27. #include <linux/errno.h>
    ; ?. t" v, U1 G
  28. #include <linux/types.h>
    ; L% \( W# H& f( }
  29. #include <linux/interrupt.h>
    : ?1 A! k' k- E# y
  30. #include <asm/io.h>
    . g( n& B- `$ X) `
  31. #include <linux/moduleparam.h>: ^. y& e- a( p6 b* Q
  32. #include <linux/sysctl.h>0 ]1 I& p  q; V9 ^- Y
  33. #include <linux/mm.h>* I/ d4 }" ]9 z  c6 ^
  34. #include <linux/dma-mapping.h>7 d: k# h+ I/ ]: b
  35. ' Y9 Z; F9 ^% {
  36. #include <mach/memory.h>
    " F: |$ K/ U3 y# r  C; u# d& }
  37. #include <mach/hardware.h>
    ) a3 U7 G' r( B: ?+ ?1 j6 R
  38. #include <mach/irqs.h>
    # k2 d& b* h5 D: L' O# E
  39. #include <asm/hardware/edma.h>4 I" M& q3 _& G  l9 v( `% q6 d
  40. 5 \7 r! W8 h  G6 I
  41. #undef EDMA3_DEBUG
    6 \, s% V5 }1 }% u
  42. /*#define EDMA3_DEBUG*/( u5 E& I2 [% M9 z- v

  43. 9 Y6 O0 X- w4 X3 s( i6 @+ s
  44. #ifdef EDMA3_DEBUG. o; E' y* c8 h3 s% \5 V+ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 n- R) {- X% w! z0 \/ V" [9 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K. N! P5 d5 l8 h6 T' v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' F3 K0 W) f+ h' R8 k! x( A  D- z( s
  48. #else
    ; v6 q, g) Z) U4 [: C
  49. #define DMA_PRINTK( x... )
    - L% G( u) Z& i& X
  50. #define DMA_FN_IN
    ! a% X; J4 m4 C  ~/ s
  51. #define DMA_FN_OUT
    0 F! g# h; Q/ k# V, P9 h+ b$ F2 b8 R
  52. #endif: b% r4 a: _) h" O3 t" i, c

  53.   H( D8 J% Z$ Y# P8 A+ k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 s9 \4 c' q, @0 l
  55. #define STATIC_SHIFT                3
    1 w  s  z9 f2 r' s
  56. #define TCINTEN_SHIFT               203 p9 Y# e  z5 O7 {- h
  57. #define ITCINTEN_SHIFT              21
    2 \3 U. F8 o% O1 W4 r% E, L3 h2 @
  58. #define TCCHEN_SHIFT                222 n( A+ R0 y9 m% l' ]' O
  59. #define ITCCHEN_SHIFT               230 T5 e0 {5 a( L

  60. / Q% b6 g5 M. F) q0 P! r
  61. static volatile int irqraised1 = 0;6 p5 \1 V6 o- S$ f1 @( \( w9 o; b% ?
  62. static volatile int irqraised2 = 0;
    ! A: a% f: N/ u
  63. # ~1 [6 l, h8 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ~7 n1 Y6 ~2 }) L" H* h+ E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) I, b' r% S" z. y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P/ i7 w( f5 q

  67. & B! c- {! ]' p0 M# g! L' s# w
  68. dma_addr_t dmaphyssrc1 = 0;
    8 Y( g7 B  s! S* Y; l
  69. dma_addr_t dmaphyssrc2 = 0;
    9 C0 J/ Q* h. D/ S! n" o
  70. dma_addr_t dmaphysdest1 = 0;4 ]) D- R; Y6 N& o1 O5 O
  71. dma_addr_t dmaphysdest2 = 0;
    $ i% V) l: O, C! M4 t' r8 p4 D2 a% r
  72. 8 m  c+ I% ~1 y; T
  73. char *dmabufsrc1 = NULL;
    8 R) H" W  I( Q
  74. char *dmabufsrc2 = NULL;
    6 Q# s: @' ]- e+ W! z' p- ~
  75. char *dmabufdest1 = NULL;. d" U$ A; s! u: Q5 |- F
  76. char *dmabufdest2 = NULL;
    6 e/ ^/ B9 P/ f! D# a. q& e

  77. % b. b( [/ ?9 Z0 b
  78. static int acnt = 512;
    % f+ O6 \9 z3 w1 u' T
  79. static int bcnt = 8;3 S# E: b) O( {  o* \; |  l
  80. static int ccnt = 8;
    5 G$ o/ Y5 R) i. _

  81. # M+ _8 \- G8 w& J/ K0 }
  82. module_param(acnt, int, S_IRUGO);. n1 m# K' S- k
  83. module_param(bcnt, int, S_IRUGO);! [0 ?( t# Z* H4 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, I1 U$ h9 w! |+ j: K/ u$ I# l% `0 R! d/ c9 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ^; P6 }3 a! f1 A9 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 E4 p( B" [) S( R$ y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 U4 [0 a! b  V5 G1 t' Q( s4 P
9 t$ b# i( ?6 q# N7 m. b
$ |/ L1 V$ E: c4 p+ `9 b9 ~: {- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-12 08:42 , Processed in 0.043233 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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