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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: N. V0 ]4 o0 r. H  ?4 |) l
  1. [code]EDMA sample test application0 z0 r( E$ ~) r( C) t; G* `0 s* U
  2. /*
    & ]7 F; @0 W# s
  3. * edma_test.c
    / j/ U9 \/ d. Z2 B' z4 V) Q
  4. *5 f' F4 @5 z5 }3 q  A& Y
  5. * brief  EDMA3 Test Application
    - Q/ Q! `% M3 D0 l* ]8 p- w' n3 {
  6. *
      ^, \2 I# m; ~' L
  7. *   This file contains EDMA3 Test code.
    ; o, e1 E/ p  j# K: ?
  8. *
    3 u1 ]# f7 z' R7 K+ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % y7 \& D' ^6 K/ G: `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' o  l/ _: D6 |
  11. *         TO CHANGE.
    - h1 @+ Q  J! x) e& d+ J' e
  12. *8 p1 v% [, j& h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* l0 `8 @! W+ y+ u& |4 \" K
  14. *0 `  ?1 @) Y  d: e
  15. * This program is free software; you can redistribute it and/or$ W: U, {8 w/ t& h/ P: G" s
  16. * modify it under the terms of the GNU General Public License as1 ?* I- j( P6 v# A
  17. * published by the Free Software Foundation version 2." x# M# I% P+ c
  18. *0 G& E5 b/ O; O7 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 S* w0 M# q' \: L" {3 n
  20. * kind, whether express or implied; without even the implied warranty
    ' O8 s0 D3 V5 x% |& C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* ?) {# j4 E0 d' ]* ?
  22. * GNU General Public License for more details., B7 C6 v7 v* }. g, \. m' T
  23. */# v. g& ?2 |$ U
  24. 2 n. J) }  l" a# v7 S
  25. #include <linux/module.h>
    8 E6 o) r0 q2 Z  \; M
  26. #include <linux/init.h>* A" }. h- p, r2 W0 g" H
  27. #include <linux/errno.h>
    ' H# m# x; {/ Q
  28. #include <linux/types.h>3 v9 U4 m5 Z/ l) ^' E) a
  29. #include <linux/interrupt.h>
    8 {7 g" L& J: c/ C. ^+ H' r; y
  30. #include <asm/io.h>% g0 {: @6 X7 B0 ^. M3 L& B- M
  31. #include <linux/moduleparam.h>7 \% r1 E. e9 @- \. b; j
  32. #include <linux/sysctl.h>
    : o. C6 k6 Q0 H2 u  K
  33. #include <linux/mm.h>
    7 \' k2 n/ [+ }$ s
  34. #include <linux/dma-mapping.h>* h5 r8 @5 [; T7 f6 ?
  35. . k7 {/ p! V3 M! {( b
  36. #include <mach/memory.h>9 E3 Y. `% f+ D8 _( @: K& }, I
  37. #include <mach/hardware.h>5 Q, ^* w7 X3 P/ V5 R( c' S
  38. #include <mach/irqs.h>) w3 k3 x4 f: x/ \1 n* k
  39. #include <asm/hardware/edma.h>
    $ B$ N2 u- p5 @: z' x2 n/ w
  40. 9 v* c3 `1 |+ G2 e6 @0 V
  41. #undef EDMA3_DEBUG
    0 p4 i4 w2 J5 ?
  42. /*#define EDMA3_DEBUG*/
    9 F0 N! n2 {) O& h7 f# w
  43. 4 c9 D$ E4 {: ?8 y! }; H% G
  44. #ifdef EDMA3_DEBUG( i9 o, {1 |% B. U: g$ _0 a0 w# A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 @/ T/ b2 G8 e, o5 M9 M$ r9 M' y* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " r/ k/ D$ i, `0 i$ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 R7 i# H- B4 x" z9 y8 V# s6 F5 A
  48. #else
    & K/ Z3 H6 Z" w' U* N7 f5 W
  49. #define DMA_PRINTK( x... )) u& b' Y" z- y6 E
  50. #define DMA_FN_IN& K7 l3 P+ \$ V
  51. #define DMA_FN_OUT
    ; k$ V! h" [8 g9 L9 L% n
  52. #endif* ]4 X5 \4 |$ o1 S
  53. ' k0 F! ?3 D. u8 C! L3 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! `/ ]. \- b8 O3 ]: p
  55. #define STATIC_SHIFT                3
    7 a  M0 n' a' z& L. i( M$ P6 o
  56. #define TCINTEN_SHIFT               20
    9 k+ t7 f1 W3 c4 X
  57. #define ITCINTEN_SHIFT              210 F' Q# Q, }3 V2 D2 I# z8 Q
  58. #define TCCHEN_SHIFT                22" ?# U  ?* e2 N2 I
  59. #define ITCCHEN_SHIFT               23" a* a# q9 N+ E  t/ i0 f+ b3 T

  60. : O% t. J+ t( t: x' b! v
  61. static volatile int irqraised1 = 0;$ e$ I2 s; c& B$ v9 }- }) B( Q0 Q
  62. static volatile int irqraised2 = 0;
    ) m& \+ o* J( i, t* t
  63. ' i6 p) [/ q; d3 U* m1 T: a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / w' f3 b+ ~0 G* f; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / P+ ?( T. o9 z, f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 l, o* f5 X2 I8 y5 N7 _7 g- J- a

  67. * ^0 P* `& M# c' \6 i6 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    - {6 v& g* ~( U% p0 |
  69. dma_addr_t dmaphyssrc2 = 0;/ s+ Y7 ~0 V, F) P' U9 o! r
  70. dma_addr_t dmaphysdest1 = 0;
    0 i! I9 Y7 T4 d# r2 P
  71. dma_addr_t dmaphysdest2 = 0;) e" ~( ?" l: X" O
  72. 2 M1 @1 i4 X4 q9 j7 U1 ]- Y/ C5 j4 N% N
  73. char *dmabufsrc1 = NULL;  j0 p: a$ @& i/ y2 B
  74. char *dmabufsrc2 = NULL;
    % c% T: k: z' f7 ^# u( k# z
  75. char *dmabufdest1 = NULL;
    ( M. o1 u$ v9 T( i2 _
  76. char *dmabufdest2 = NULL;3 x- o; E" J" `" r0 `
  77.   F$ D- p, i5 \6 D/ h- L* Q# Y
  78. static int acnt = 512;
    5 V/ X: Z0 y$ i' ?6 ~5 q
  79. static int bcnt = 8;: {! L1 m+ w1 a+ G
  80. static int ccnt = 8;) P6 ]) `0 }1 m9 G) ?9 l

  81. , s/ g6 d* X, p  H4 B5 S
  82. module_param(acnt, int, S_IRUGO);& M0 t2 b  G' H" ?
  83. module_param(bcnt, int, S_IRUGO);5 g( K, J- W0 E, F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 N) L" v2 c7 d- K) e$ D% ]3 L

/ G1 W, ^* \) m' J+ h. r3 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 {2 X  v" i, ~3 d3 a% k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  d% w- Q' s# _3 O8 }/ K) s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ p7 |( d# Z8 S. n& \. R

0 X+ c2 }0 \+ L7 W4 m* S; \5 j" Y6 m' h8 G3 U' C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 15:07 , Processed in 0.038230 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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