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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( g5 ^6 c6 F. X; w  h  P
  1. [code]EDMA sample test application
    0 @7 o; K& P8 b$ d2 t
  2. /*
    ( O9 _& h& a1 ~& K1 X5 `
  3. * edma_test.c
    / C8 s  y' j" X, K# Z5 J; ^$ B/ J
  4. *
    - {  I! |7 c' A0 Y$ l
  5. * brief  EDMA3 Test Application
    * w5 z) R& j) I9 A: J3 `* Y' S
  6. *6 J, |/ I( R" k7 [  A
  7. *   This file contains EDMA3 Test code.- s$ Y& t* }" r7 [( n6 p1 j
  8. *6 D. P7 C4 [9 W! U' h' `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 U, U7 I& C. ]: o" v6 I: D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( b: u$ v+ o6 y4 D: y7 F4 _. z
  11. *         TO CHANGE./ \; G4 a2 G! g; i' l
  12. *
    / P6 S2 n, v) t& n) j1 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 B) j+ S0 e0 o1 G7 T1 G+ Y! {
  14. *
    2 X9 e  ]1 X# s1 d+ R
  15. * This program is free software; you can redistribute it and/or
    % K$ W/ V" N" o
  16. * modify it under the terms of the GNU General Public License as! J: r' Y7 s/ F
  17. * published by the Free Software Foundation version 2." l% i5 R5 f6 f9 E2 m- g4 y5 s
  18. *
    5 h  K5 k1 a  ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  i% e. _7 {0 |4 n5 T: h! H
  20. * kind, whether express or implied; without even the implied warranty- e' ]+ y* U3 P  C" ^; D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 @5 c" v" E" |
  22. * GNU General Public License for more details.
    2 i/ W) |/ R5 X( u2 O% v/ a3 M! N
  23. */
    9 {  a" s% M. b! T0 y

  24. ) U) ]4 M& H0 l6 r* _. Z2 V
  25. #include <linux/module.h>& V- ~! M- f- W! i: ^( }; `, q
  26. #include <linux/init.h>
    0 j6 S8 M, Y+ q. H, z; e- C
  27. #include <linux/errno.h>2 i! d* s4 o# Y
  28. #include <linux/types.h>
    9 N- B* W! }0 t0 B: u1 e) z
  29. #include <linux/interrupt.h>1 R' X9 w# N  f# G
  30. #include <asm/io.h>3 P) }( u+ v6 O0 [$ j1 J
  31. #include <linux/moduleparam.h>% j8 j- s+ L8 W' s/ o' J0 \; k+ D
  32. #include <linux/sysctl.h>
    : j5 I9 Z- [. ^' Z
  33. #include <linux/mm.h>
    9 X. o" S  B/ F2 {. O7 u# Z: P4 n
  34. #include <linux/dma-mapping.h>- G; _. l. {: u7 a0 @$ G, [2 @

  35. $ e( u$ T  ^5 l/ q
  36. #include <mach/memory.h>4 k2 `5 j- s2 e
  37. #include <mach/hardware.h>0 U0 u& Q2 a- ?4 y2 ?  S6 _9 f' o
  38. #include <mach/irqs.h>4 ]8 E$ D# p5 M$ d( O: b
  39. #include <asm/hardware/edma.h>
    ) H+ N1 z. Q0 _; f) M
  40. * X6 m/ @, [& u; ]2 e! x
  41. #undef EDMA3_DEBUG8 z9 ^7 T$ x) o! U1 M3 l9 q8 j
  42. /*#define EDMA3_DEBUG*/
    # i$ v& p$ h% r3 L+ u$ @- ?2 F
  43. ; V1 J# s0 H  B* X" G
  44. #ifdef EDMA3_DEBUG4 G7 x% z  s% q+ R3 y5 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* z' Z* M- s$ y: q) w& ?0 T- z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ u( o# {% t# h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g5 S5 }& j! W; R
  48. #else8 s: N- m7 e3 M  B7 u
  49. #define DMA_PRINTK( x... )! q! G  a% Z( ~8 F  M
  50. #define DMA_FN_IN
    " t! a) K$ j& r6 N- @! ^% A% v
  51. #define DMA_FN_OUT; A) \5 h6 I0 `5 ?2 ?8 R
  52. #endif
      A& s$ e+ s4 E, D# ]! `5 k
  53. 4 [2 Y8 T  K5 `1 d4 _2 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Y1 D7 i( w! M
  55. #define STATIC_SHIFT                3* B% B7 }- ]& \* L7 d) W
  56. #define TCINTEN_SHIFT               20
    9 B* C* D2 L; C" E
  57. #define ITCINTEN_SHIFT              21* g) Y0 U: o4 c8 A4 b* V; E
  58. #define TCCHEN_SHIFT                22: A, i* n8 s  B# u, c
  59. #define ITCCHEN_SHIFT               23' K9 Y/ I0 U; O; Q

  60. & Y7 k/ M1 z( X# f. |
  61. static volatile int irqraised1 = 0;
    ( ^+ w( R3 v- o" c+ K
  62. static volatile int irqraised2 = 0;2 g$ P; I$ M' L" A- e0 g% W5 ^* p
  63. 3 d3 `3 S0 ^  j! l" F1 W# b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u5 z- z4 Q9 S5 T1 }) K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 j; Y8 f" e7 X4 k# O& q3 @9 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 @+ d) B) _9 o2 K) @) m
  67. ! g+ h4 Z! B4 b6 G7 g0 c$ h
  68. dma_addr_t dmaphyssrc1 = 0;' Z0 Q& |/ X% t. Q: s
  69. dma_addr_t dmaphyssrc2 = 0;4 A2 A3 Q7 v  K- Z& g
  70. dma_addr_t dmaphysdest1 = 0;- s9 e8 N# k# J" S
  71. dma_addr_t dmaphysdest2 = 0;' |' X$ a! d( G- E
  72. ' o. s. `5 k3 {$ O( _4 M
  73. char *dmabufsrc1 = NULL;
    ; G, x6 o# v. j9 ~7 T. @& B9 |+ z
  74. char *dmabufsrc2 = NULL;  @) {: C4 D5 k/ F# |
  75. char *dmabufdest1 = NULL;: `7 c3 N8 \4 U/ s# e; Z* w
  76. char *dmabufdest2 = NULL;
    . h) E8 m" e/ I7 p
  77. ; x' W9 K" h9 |% I& n3 e7 Z
  78. static int acnt = 512;
    % x, i$ d6 Q& L) b( Q" w: D
  79. static int bcnt = 8;  X9 S& M, I, d
  80. static int ccnt = 8;
    5 b- a: }5 z. ^

  81. $ D  y) O, V4 W5 R( ^9 b
  82. module_param(acnt, int, S_IRUGO);
    1 k  d  X, @5 G; z
  83. module_param(bcnt, int, S_IRUGO);0 N2 m6 \  f3 \0 H. ?2 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ P$ R& c3 \9 I/ x& b5 U2 B; u8 |3 c' _
) i" L4 i# q# k2 _) N  C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 p, F9 [$ P- E) e2 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z$ G% l( n* D$ L6 o7 s1 h) {, y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 g. p% p9 r6 q2 Z$ I
5 \( q2 b: r  P; g6 h" M# L2 O( }
" p/ W- j1 l4 A+ N: v+ H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 09:25 , Processed in 0.040381 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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