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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U9 D/ F( b+ q% O: y
  1. [code]EDMA sample test application. L. Q/ X" B8 Y% S
  2. /*7 t' E( j  X- P" O, K
  3. * edma_test.c: @; O- Q7 w0 a  I2 d
  4. *
    6 E6 ?; k+ ^. m+ [* t2 X7 U2 Q
  5. * brief  EDMA3 Test Application! q5 S" A" x) ?$ i& }# }- Z
  6. *# l- k! u+ x8 e4 h' L' Y: l
  7. *   This file contains EDMA3 Test code.
    1 a2 C+ ~7 Y" |- d. V5 [
  8. *: X4 K/ h$ @* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 f0 Y: v& w: p* M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" M& s1 `0 A7 ~1 U$ n
  11. *         TO CHANGE.
    & s, L5 Q% `( d& g
  12. *
    0 _: y: K: o; D5 ~( b) v+ f5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 F% }2 P. v/ z! X
  14. *6 `  P0 y, u3 _" ]$ H
  15. * This program is free software; you can redistribute it and/or
    3 ]( ?4 J7 N: M+ S7 U& T5 }5 P
  16. * modify it under the terms of the GNU General Public License as
    6 Y$ ?1 m/ x! @4 K8 v0 H
  17. * published by the Free Software Foundation version 2.
    6 O9 Z( i9 i: [& r) n. n: x3 U
  18. *6 d2 r$ _6 j. G) J: {8 |# }! z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z! n7 v' }2 v5 @% t# i& r
  20. * kind, whether express or implied; without even the implied warranty
    ) }: o: @& ]4 n) L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. p; `& `' B- c0 ?$ s5 M
  22. * GNU General Public License for more details.- G9 h+ X$ T8 a% P- l
  23. */# G  l0 e8 p' m0 c3 I  I

  24. % Y; V+ z1 A) m* F6 W
  25. #include <linux/module.h>
    , z; I( M# Q1 O4 m1 m+ ?6 d0 ~
  26. #include <linux/init.h>
    ( N4 P; p7 b* M/ m5 l' v
  27. #include <linux/errno.h>
    , E% _6 L, U5 A9 {
  28. #include <linux/types.h>4 i/ L- U$ Y0 M' a" E" l
  29. #include <linux/interrupt.h>7 y* E/ `0 {. y. W( j5 H
  30. #include <asm/io.h>
    7 @" U& }9 b, h) H9 s
  31. #include <linux/moduleparam.h>
    " N& \" J, S4 i9 h+ Y% B7 t! E
  32. #include <linux/sysctl.h>
    ' |, w0 y, ?& }* L3 Q+ y% ]
  33. #include <linux/mm.h>( W0 S( \! K' j' w
  34. #include <linux/dma-mapping.h>
    7 V( q( @8 v. K% t/ U3 B
  35. 0 A% ?4 L' m9 o
  36. #include <mach/memory.h>
    9 C  a- f* t* p* P7 V
  37. #include <mach/hardware.h>
    5 \' p- P1 m3 ]/ k+ u6 O7 v
  38. #include <mach/irqs.h>
    ) {( _1 C! ?0 t9 }
  39. #include <asm/hardware/edma.h>
    & M1 h- V5 d+ D* f# r$ D" ^# S5 R

  40. + {! O; F) ]; u3 r1 E8 N8 }
  41. #undef EDMA3_DEBUG1 b2 B# b, o8 u
  42. /*#define EDMA3_DEBUG*/& T0 F) T$ h: E; t* c: C
  43. 3 u3 ~, h, g2 l3 k  z" k
  44. #ifdef EDMA3_DEBUG
    ) z, n5 m+ U1 i( ^8 w$ \4 q4 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w" F  B9 @/ B% L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J: C+ X2 w+ C3 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' R9 E9 d" m1 V% n+ e( r
  48. #else
    / |+ [4 ^( n7 {* {, w3 l4 [
  49. #define DMA_PRINTK( x... ). W3 i8 E3 G! y7 I" d
  50. #define DMA_FN_IN, i( z+ K" A  r5 z. z' H
  51. #define DMA_FN_OUT" m) F6 ]* h/ J/ t% A, I
  52. #endif* s0 D1 N, V+ l2 k! f2 _; y

  53. ' {' B3 R; d  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " o4 j; I9 ~) w# N8 U
  55. #define STATIC_SHIFT                3. ~( E$ r" Q' I9 F0 m% `
  56. #define TCINTEN_SHIFT               20
    ( J& K& z& t" F' o/ i/ x9 D! E
  57. #define ITCINTEN_SHIFT              21; G% a4 i" f, R/ S* h. f
  58. #define TCCHEN_SHIFT                22
    ) W$ F. v# d6 N  p8 R& B! n9 i
  59. #define ITCCHEN_SHIFT               23
    2 t" I8 Z4 ?+ p* r% O
  60. , K$ e! b* v3 L" M( i( t
  61. static volatile int irqraised1 = 0;' H; E5 N2 ]0 l' v& v- v
  62. static volatile int irqraised2 = 0;, j7 S; S& s+ B' z( X4 q9 w" Y; d

  63. , {0 H& d! F0 w1 ^7 f; s& I) E6 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e( G% R( U& x5 K9 i5 p, u. g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ a' W, p9 Q. c. z" u- F. n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d$ k4 ?% O0 H: I" W
  67. 3 g4 W) x5 q3 p9 S
  68. dma_addr_t dmaphyssrc1 = 0;
    6 j: O+ M1 E( R6 z
  69. dma_addr_t dmaphyssrc2 = 0;, n% t3 c9 E: `8 x/ ^' X
  70. dma_addr_t dmaphysdest1 = 0;
    " W7 H, N$ m/ F: k
  71. dma_addr_t dmaphysdest2 = 0;
    1 o0 D% S# J. [- m4 `+ a$ Y( i0 Q
  72. " `2 I4 S( W, c  h: U: @
  73. char *dmabufsrc1 = NULL;
    3 J+ O0 L9 H, B; i# I) o$ k
  74. char *dmabufsrc2 = NULL;
    ! ^8 q# U" |0 |1 X7 p9 e
  75. char *dmabufdest1 = NULL;) U0 k! c8 O5 H# B
  76. char *dmabufdest2 = NULL;
    ( c' _3 ?4 m# Z9 M& I; r, @: r
  77. 0 I$ }; y0 @" J$ ~, a8 s3 e* Y
  78. static int acnt = 512;
    4 f, Q, K$ p* b9 s% {# t
  79. static int bcnt = 8;
    + D/ b6 H6 W& I8 `$ Y
  80. static int ccnt = 8;
    , m4 A4 K/ |7 |( ?

  81. 2 ?1 r2 w+ B% B5 s* f
  82. module_param(acnt, int, S_IRUGO);8 M5 Y$ b# Y) A2 y' X- G9 q
  83. module_param(bcnt, int, S_IRUGO);
    + }$ S7 k' A. W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* A5 @5 @) G4 V4 @

" X# J& V' b  l; @4 d) t  C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ u2 @; _( _; B7 e  ]9 ]) y2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) c! m. H0 g* T0 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& o- ]/ ]- o: d( d: s1 l9 h( E: ]8 N) [
7 p+ I7 z2 S5 `2 p  Z( N" N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 07:25 , Processed in 0.054629 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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