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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   p! g- x4 T& f% Q6 {) D0 u
  1. [code]EDMA sample test application
    ( d. p6 o0 t& |! k  I/ B# ]1 U
  2. /*
    8 N2 B7 M4 m& v
  3. * edma_test.c
    7 Y0 \0 k) O0 L' ]2 ]; _5 P1 e& o; F# k
  4. *
    - F; Z2 w' X4 N; o7 B( V
  5. * brief  EDMA3 Test Application  |( h" z8 `0 b* O
  6. *
    ; i) W" P( K% H* T; w) ^
  7. *   This file contains EDMA3 Test code.
    4 I8 i# ^3 r& k4 {% B/ S* \6 H
  8. *
    1 B1 d7 t  A/ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      o8 |2 g3 O  E- D' u# U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?* y! {2 w6 A3 l
  11. *         TO CHANGE.
    " A( |, U' U- Q+ g8 o  D) x4 u$ s
  12. *
    - t; _* g* M: q8 d  U# n+ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & K& E& K, U9 a0 \, @2 i
  14. *- i+ E. ]$ S' o' |7 J, @4 g: X1 F
  15. * This program is free software; you can redistribute it and/or5 i. [7 ~3 b9 c" ~' G
  16. * modify it under the terms of the GNU General Public License as' S6 Z! G  b5 M9 k5 `
  17. * published by the Free Software Foundation version 2.
    / k/ l. u/ D4 x' |8 j9 J
  18. *
    , {! U% |; I9 d& N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" q/ s( b; ~* F$ L8 r
  20. * kind, whether express or implied; without even the implied warranty7 O( o/ U5 F  e9 O" N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) W4 `& U* C6 J: g# k9 U  D
  22. * GNU General Public License for more details.3 d) k" N% o) x" v
  23. */: n; w  a* Y) [  m3 Y* [

  24. 4 [# K+ V' P) {! L" X* ^, t
  25. #include <linux/module.h>- v- t) X/ U+ f
  26. #include <linux/init.h>- x% q2 Q$ C  E/ l- r& f/ D
  27. #include <linux/errno.h>  Q7 L$ o$ c& O$ A2 q
  28. #include <linux/types.h>
    ( t' Z6 O% D6 U8 H7 L& g
  29. #include <linux/interrupt.h>
    5 U* h$ z3 d4 F3 x$ h  z# R" D
  30. #include <asm/io.h>
    * F7 N( p: J2 [4 Z0 l# b5 j$ u8 \/ J
  31. #include <linux/moduleparam.h>7 i7 V) _7 e8 q3 k2 A
  32. #include <linux/sysctl.h>) k2 \/ w" e4 j( d% e3 P
  33. #include <linux/mm.h>. o6 K3 C7 _. k9 g; ^) T' A, H4 j! j' ?
  34. #include <linux/dma-mapping.h>
      R8 o( n$ H) p0 l
  35. ) C& `  x& n( Z: z8 q/ k
  36. #include <mach/memory.h>' c% _. E4 n2 N; m! h: q1 v
  37. #include <mach/hardware.h>7 P. p- p. Z: U6 o
  38. #include <mach/irqs.h>
      L! ]- k8 t! D" f0 ^$ l4 R3 [8 S8 d
  39. #include <asm/hardware/edma.h>
    7 u+ u; h: X. @3 G. r! \4 ~
  40. 1 |3 c; y, o/ I; `" ?* p' [
  41. #undef EDMA3_DEBUG
    1 g) A: D: J9 X
  42. /*#define EDMA3_DEBUG*/
    : f) s# N$ v% q! j3 U0 D

  43. ; Y' p( ^3 w1 \7 W9 }
  44. #ifdef EDMA3_DEBUG7 r. }4 q& U+ _0 X/ ~8 J5 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 G1 e9 I0 D0 }% V% p9 y$ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 a, V4 P) ~- H) e! }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 H" F, P7 D3 ?1 u1 A# z! u
  48. #else6 B$ r* g: {" r4 F/ F5 F
  49. #define DMA_PRINTK( x... )
    7 {# d$ R$ u/ ~/ y. i/ ^0 w% P
  50. #define DMA_FN_IN( v; \: K, e( `/ q
  51. #define DMA_FN_OUT
    8 s3 K3 S0 u7 }
  52. #endif; |0 I; [- Y8 ^

  53. 7 ^& S% G+ j9 ]# F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : |. a1 {! I, S2 F
  55. #define STATIC_SHIFT                3# J" p9 G( [$ k+ J# q% u
  56. #define TCINTEN_SHIFT               20- G# `- h0 Q9 X9 b3 W* u
  57. #define ITCINTEN_SHIFT              21
    3 J4 W4 L( k' `/ k( |
  58. #define TCCHEN_SHIFT                22
    & m& L) T0 C- I# f) G0 {7 q
  59. #define ITCCHEN_SHIFT               23" f6 j) i2 t" V: {, q3 k

  60. ) i7 ^2 }: \: f. A
  61. static volatile int irqraised1 = 0;
    # @  D0 a& u. o2 F1 R1 I
  62. static volatile int irqraised2 = 0;2 q9 w  a6 ?" G$ Y7 S
  63. 4 E; d9 B4 S9 L6 u: Z3 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 i1 `. P2 h2 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 B% H. t8 R3 Y8 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a9 g' m) X8 ^

  67. - |' k2 T7 {) S! T/ H3 R
  68. dma_addr_t dmaphyssrc1 = 0;2 B$ a& R6 Z* b- y8 k' ]! S# t
  69. dma_addr_t dmaphyssrc2 = 0;- A! }# K, `. s7 H, D+ z' n  V1 p
  70. dma_addr_t dmaphysdest1 = 0;
    ) J: ]/ {) s! q  s
  71. dma_addr_t dmaphysdest2 = 0;
    & |/ C# b+ O$ y9 }. E: C! v
  72. + c& Y; [* G/ S7 V
  73. char *dmabufsrc1 = NULL;: D' L% k9 H2 D+ m: d4 L; ^
  74. char *dmabufsrc2 = NULL;( W+ N: J  A1 f
  75. char *dmabufdest1 = NULL;. f' P7 O" W% v. A& h
  76. char *dmabufdest2 = NULL;
    5 A/ ^* H- k4 n6 L: k) E+ k2 V

  77. 7 h" W( ~- q& x. G/ G9 M2 e7 f6 h3 Z
  78. static int acnt = 512;4 f1 x5 h# W( K# E6 s; h2 k  i
  79. static int bcnt = 8;
    ' D; L6 Z# F' C$ H. _" m
  80. static int ccnt = 8;
    % i$ |3 e2 A& z# p, v. t) X
  81. 0 g" R5 ?* X; Z1 L* j
  82. module_param(acnt, int, S_IRUGO);) k. q& |5 E! f* _: f
  83. module_param(bcnt, int, S_IRUGO);2 A" o4 P2 I5 H7 ^2 v' P' O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 N8 D! w9 z* A7 C  B
0 X! e4 ?( @( y: l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ J! }+ a+ w) c5 d& m7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) I, f2 O6 L) ?1 g0 ^; f# C6 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- i4 _  R& g! D+ {, g# H# B2 }/ X  k& t& Y4 U
- @6 U% H! @! A' X& w9 Y' m6 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-28 06:22 , Processed in 0.039967 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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