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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 N4 I/ C- z) F# s. N
  1. [code]EDMA sample test application3 W. P7 {8 L  e
  2. /*
    & a& q0 a5 V+ A% K3 w% H
  3. * edma_test.c3 y" D; D+ P% c/ _" J/ K0 }3 P
  4. *
    9 s6 L( x; [  f, `1 j- Z# u
  5. * brief  EDMA3 Test Application  P" H6 I; w" G# ?) h( ]& o
  6. *: S3 _* L7 J, W9 i+ z( w& p
  7. *   This file contains EDMA3 Test code.
    " |% w2 K, M' {4 Y) C% v6 x# y+ ~
  8. *
    3 y' J1 V8 n3 L, c2 @+ Y2 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ^/ L0 g: c/ s/ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! s& U( f( \7 o$ C
  11. *         TO CHANGE.8 }+ F% y% K" b& X) e# a. Y
  12. *
      D2 o/ [+ R7 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / M$ g6 N2 l% Q, j7 {5 |; {
  14. *5 y( D: {) [% n6 ?
  15. * This program is free software; you can redistribute it and/or
    % z; m* q; e+ E$ D( p1 M6 l
  16. * modify it under the terms of the GNU General Public License as# Y6 D" ?6 [' L7 D! O
  17. * published by the Free Software Foundation version 2.: G1 W! b* y( H! e7 l! v' Q2 Y
  18. *
    6 U/ f3 D$ I! x$ w9 X2 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z8 [/ S! S5 U; W1 W; X$ N
  20. * kind, whether express or implied; without even the implied warranty6 |: z' J9 Y8 l' m; o# b5 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! v/ k2 Y2 Y5 c0 T  n- O) d
  22. * GNU General Public License for more details.
    ! O" a5 ]* x7 x, g; f
  23. */& j! E9 j3 V4 m* D! J
  24. ; q# p5 W( e, P' W. B) |
  25. #include <linux/module.h>2 C' b9 C4 w7 p8 j# ^
  26. #include <linux/init.h>
    " Y; e) v8 S$ U1 ^
  27. #include <linux/errno.h>
    8 S- p; d0 O9 R# Z) A
  28. #include <linux/types.h>
    - H+ `8 X3 U7 Q7 g
  29. #include <linux/interrupt.h>* }1 B8 G' i7 |, U; i. ?
  30. #include <asm/io.h>" ^" v8 V1 y* S6 S7 Z& @+ y  y
  31. #include <linux/moduleparam.h>
    8 K0 d+ l0 u* C: C2 Z3 B
  32. #include <linux/sysctl.h>
    * a" q: W& d( g( c6 Z+ h1 \  }
  33. #include <linux/mm.h>
    - B$ p; v3 |" `. _
  34. #include <linux/dma-mapping.h>
    ; M9 p2 Q7 f9 \% Q

  35. ' _7 h. w, v" }4 c6 I3 z
  36. #include <mach/memory.h>
    6 l5 [8 e4 s7 }; o+ l
  37. #include <mach/hardware.h>  B  u, W' C8 Y6 f# f, T0 t, ?
  38. #include <mach/irqs.h>
    $ H" m& I5 l) w: L& n6 O
  39. #include <asm/hardware/edma.h>6 G2 I( H8 f' ^  q) E1 b5 y
  40. 7 _9 v; H2 B* c
  41. #undef EDMA3_DEBUG
    2 K$ _. v3 M( ]
  42. /*#define EDMA3_DEBUG*/  b5 J+ F9 ]- U8 J. R  U; N; ~+ }8 \- C

  43. 3 _1 Q  }1 Y' T+ s/ ^/ [
  44. #ifdef EDMA3_DEBUG
    & X) {0 c4 Q$ Q/ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' d2 J* ]+ d- V3 C5 R0 I1 x: R2 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 L0 x1 J5 h; e! d7 I9 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , g! n" s6 J# e) X1 H' I
  48. #else3 p. `4 W; d$ Q
  49. #define DMA_PRINTK( x... )3 V4 P( S& a9 m( D7 \, `( x
  50. #define DMA_FN_IN0 D& ?6 I. X7 q6 y6 g) `' Q0 L# \
  51. #define DMA_FN_OUT
    / ^& S" T8 k$ ?) Q8 s; l& ^
  52. #endif
    - `/ d3 L4 ]5 B4 x8 N
  53. : y% U3 g; C: }2 U) |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# c/ n" Z% R4 M4 ~
  55. #define STATIC_SHIFT                3
    - F( Z- M& P7 l$ h$ u7 v) X
  56. #define TCINTEN_SHIFT               201 t8 B, T4 J; j9 |8 U- y( u  C7 z
  57. #define ITCINTEN_SHIFT              21: n$ b# h( i% c: A8 X1 x; f: o
  58. #define TCCHEN_SHIFT                225 S: R& M- U1 ~! i4 x  \: _
  59. #define ITCCHEN_SHIFT               23  b2 f& ]( r, E: ^
  60. 7 t& @2 c1 i3 u) d8 j, R& H5 `/ f# z
  61. static volatile int irqraised1 = 0;
      O, {( W* R& X! s6 `7 {8 Z2 S
  62. static volatile int irqraised2 = 0;) b- P7 c0 ~9 H. A. w7 ]) G

  63. : [! H2 u. @3 _4 n4 k3 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T' ^% w% K& i/ a& J3 u( r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ^0 R0 V  P0 q  p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; U# D' s! C7 L; C9 W. i* i; P# [

  67. 8 W: B2 C5 `3 Y1 J$ E6 U4 h
  68. dma_addr_t dmaphyssrc1 = 0;
    1 d8 Y/ x: @4 t
  69. dma_addr_t dmaphyssrc2 = 0;
    % r" ^( }+ q: X0 H
  70. dma_addr_t dmaphysdest1 = 0;% j+ `- U" U1 \4 ?/ j: K
  71. dma_addr_t dmaphysdest2 = 0;
    ( y% F. p# _% V- n
  72. . R, |) V: C, S  w+ f
  73. char *dmabufsrc1 = NULL;
    / d8 i( L7 B/ W" r
  74. char *dmabufsrc2 = NULL;
    8 \4 U& O: W, u
  75. char *dmabufdest1 = NULL;( T" s; z: N3 y/ s$ a4 y
  76. char *dmabufdest2 = NULL;
    % v1 P8 l: Q' o
  77. . F1 t9 F' l) i& c2 r. i) l9 [
  78. static int acnt = 512;: F* p4 ^/ H/ L$ |" c+ b
  79. static int bcnt = 8;$ t- x- O) G% O6 D
  80. static int ccnt = 8;
    & J- F* [" N8 [+ q5 \
  81. 7 F2 {& U* s3 d: f5 z
  82. module_param(acnt, int, S_IRUGO);& b5 [! H. }" y; ^& h* T
  83. module_param(bcnt, int, S_IRUGO);2 l5 d0 x$ C& h+ X( ]# w0 M; a; R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 E3 M3 ~1 {  @) v2 ^+ i% z& s
8 T% O* z! |  s7 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, d! L* }( F& [; `+ [- c5 T" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u* ]/ Y' m5 K' P# t8 ^7 Q7 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ B- Z; q* u5 t: y1 g( a; q
/ I6 W$ C9 n3 N
) x3 @% x; k; {+ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 01:47 , Processed in 0.049221 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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