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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % {' E8 e2 r7 p- Z( w. \" A
  1. [code]EDMA sample test application6 t! ?- M; Y9 u5 [
  2. /*, e  O  E, W2 ~' e. Q5 W
  3. * edma_test.c
    9 W' \5 G- L' v1 Y. o/ k! x& B
  4. *4 W; v3 G6 m* g3 W4 R
  5. * brief  EDMA3 Test Application
    5 s5 y2 c" S4 @' l) ?/ x) m; h
  6. *
    5 x0 i: O5 x$ E$ G$ J% K# o
  7. *   This file contains EDMA3 Test code.. n3 B3 k4 t$ J& m4 A3 J* d4 E6 l
  8. *9 A; g( E+ m! M" [' J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ?5 K; h/ }( J: p4 J; `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 Q) @1 i' Y8 r' x9 W9 f
  11. *         TO CHANGE.
    $ b- \% O" {: {) L: a! X
  12. *. V  B5 a4 |1 C3 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      k$ ^5 U. i) x* V  C
  14. *
    5 p$ Q8 R- n2 e2 r
  15. * This program is free software; you can redistribute it and/or& L( O+ R+ J  `: r* E* E
  16. * modify it under the terms of the GNU General Public License as
    ! F4 @' I. @2 z+ q! O- T( S
  17. * published by the Free Software Foundation version 2.
      w7 [1 M3 J! P% A
  18. *
    $ ~6 d7 q- }, O2 X+ H, Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . _/ R( _2 I. a; _4 s
  20. * kind, whether express or implied; without even the implied warranty6 C9 ]8 z+ R% g. e0 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& e: ~$ e. l% |- p+ F
  22. * GNU General Public License for more details., }, l, ?* ]/ B; R+ A
  23. */
    ) N2 ~8 |" n% b) B* V# g+ ]4 i
  24. 7 W) n4 H% A# R( ?8 z+ M1 a- J, z  l
  25. #include <linux/module.h>9 \% L# @: g" V1 `! m
  26. #include <linux/init.h>7 j0 ]# H( P- g' H# s" Y/ ?
  27. #include <linux/errno.h>
    2 c9 c' Y2 |8 I5 G; c) C
  28. #include <linux/types.h>
    6 S( Z% O9 j! S
  29. #include <linux/interrupt.h>$ k0 G, S) x7 ]9 M. ?3 F2 C* r) x1 y
  30. #include <asm/io.h>. ]  W; Z$ Q6 W: z" X
  31. #include <linux/moduleparam.h>
    0 q) ?6 u, I/ C
  32. #include <linux/sysctl.h>( t+ D' @  z( ?& L! p3 ]5 p  z) Z+ n
  33. #include <linux/mm.h>
    + x6 u6 ^$ A+ K8 U! Q
  34. #include <linux/dma-mapping.h>
    # k5 p+ k! p$ I0 k) J

  35. * u7 r) y7 J3 V- F$ J' k
  36. #include <mach/memory.h>: h! m+ ~# ?; a3 I4 i, B
  37. #include <mach/hardware.h>) e. s% `$ h5 ?9 u
  38. #include <mach/irqs.h>7 X- v+ |7 Z: Z1 \& R' m
  39. #include <asm/hardware/edma.h>
    , }% Y1 }3 r/ h5 i
  40. . X" B% ]; s$ }3 o: @3 T! F2 I
  41. #undef EDMA3_DEBUG* |) Y# w5 x, e* C! r# n
  42. /*#define EDMA3_DEBUG*/
    5 L, a% c# z& a# O( k# U& x

  43. ; [: z; L9 I% M
  44. #ifdef EDMA3_DEBUG$ R. |6 y; v7 d8 {! z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N3 {; m( h& |0 p6 q5 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . z# L7 |8 |6 v2 G/ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ h6 }4 R# t8 ^* b4 F" Q, |2 U' B
  48. #else
    4 ?/ Y! }# O: V% ]0 S# \6 P
  49. #define DMA_PRINTK( x... )
    " K; s) x! f! E+ Z7 f
  50. #define DMA_FN_IN& e- c( l. p  C5 H
  51. #define DMA_FN_OUT$ S" a& z) g5 n, X0 M; h5 R# x0 H
  52. #endif7 l* z4 C. G( `9 m1 X% {
  53. 2 n& N% K2 }" r4 [+ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 H  V, e/ q5 _. y
  55. #define STATIC_SHIFT                3- {0 V- k. T" d
  56. #define TCINTEN_SHIFT               20, X# w6 @8 S" d2 k5 O, I4 \& u: ~
  57. #define ITCINTEN_SHIFT              21
    2 E4 J* y  Z" ?
  58. #define TCCHEN_SHIFT                22
    ; j4 D. w+ L5 G8 R! o  ]
  59. #define ITCCHEN_SHIFT               23$ [& A( J/ ]- m/ c& Z
  60. + R$ A* {* L% V0 _9 ^- L4 p
  61. static volatile int irqraised1 = 0;
    - d8 o, y4 N0 ?
  62. static volatile int irqraised2 = 0;
    $ K0 p+ v& y, ?
  63. 4 [6 w* E( X$ r! K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H+ t9 z7 [2 x$ w" W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c; R; j& u7 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S3 o; P: M8 b& B# j

  67. 1 ~, M0 c1 R7 d3 L, Q. {0 B" a" P
  68. dma_addr_t dmaphyssrc1 = 0;0 }# {- E# ^& R, n' d
  69. dma_addr_t dmaphyssrc2 = 0;
    1 ^$ F; h8 j7 z7 N1 [- d
  70. dma_addr_t dmaphysdest1 = 0;  A. i  m/ y8 e2 ]
  71. dma_addr_t dmaphysdest2 = 0;
    ' t* a+ {9 k1 |1 P; X$ k0 Y. _# M- ~, S4 V
  72. ; R! o1 V4 r) Q. Q" `
  73. char *dmabufsrc1 = NULL;& W( s7 Q1 |8 `) Y2 p% x% i
  74. char *dmabufsrc2 = NULL;' G4 O  T( [4 c4 l, f
  75. char *dmabufdest1 = NULL;% `$ y' N7 {1 k* f* ^8 i
  76. char *dmabufdest2 = NULL;
    : v; P$ B" L# v1 o+ e* ^  w' [

  77.   k, y6 m2 {- j+ |8 O
  78. static int acnt = 512;
    , }- ^: T5 i6 K1 u
  79. static int bcnt = 8;* l0 G% I2 V" B4 \; x
  80. static int ccnt = 8;( B6 h$ J5 n1 o: g+ y& b! ]
  81. ! R% h; y6 R" p0 X
  82. module_param(acnt, int, S_IRUGO);+ I1 f( F2 B3 i) |& d% d1 d$ _* Q
  83. module_param(bcnt, int, S_IRUGO);
    - {+ n: R( p. `# s  R9 t, _" _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 _! q8 P* b- N# U0 P
3 i9 ?, F1 e, ^9 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; s3 u0 T! W: P) b5 ?" L% i5 j* k/ S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  q7 z- ?8 _: C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L! x$ h9 b+ J* L0 K2 V" Q4 _0 p! F$ \* k

: t0 u1 Y* C+ r! s, ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 23:42 , Processed in 0.038402 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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