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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ H! F9 S4 V7 A& ?5 H* S& }) C
  1. [code]EDMA sample test application
    7 @) p8 f3 P4 I- B) _. Q' ^# u
  2. /*
    7 W! r9 @# l/ H4 }- K
  3. * edma_test.c. m% \- G+ v4 o4 B+ ]& p' [" S
  4. *
    6 }8 a4 P. }! W; h5 u% y9 l
  5. * brief  EDMA3 Test Application
    * i; d4 k1 o( @! ]4 {
  6. *
    5 h  f) Z0 `7 M6 j, L2 N& i
  7. *   This file contains EDMA3 Test code., Y1 _$ k, T& N4 V0 r& R
  8. *
    + I8 l/ G, F  X' V  j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 g9 F, V% Q: k6 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 k' Z" N: A, H0 ^  _- j
  11. *         TO CHANGE." F  {/ J/ c- B$ @( \% D( G: G
  12. *  V: H$ S' Y7 A: i. e: |5 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & D/ v8 f# [; N: u$ V5 ~
  14. *: A2 I- U* r' V4 G6 N* ]9 `
  15. * This program is free software; you can redistribute it and/or' I2 t1 B1 ~* c; W
  16. * modify it under the terms of the GNU General Public License as
    * {& M: b( o% n* f0 k, r5 R$ i
  17. * published by the Free Software Foundation version 2.
    1 ^9 O4 E" d" U+ R
  18. *
    2 G% u% a' B. |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( L6 D- ^) H) X5 y6 P' M  R+ N
  20. * kind, whether express or implied; without even the implied warranty
    , F- t/ J6 K: H: O/ A3 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 s- e' R' b+ @& @* H! j- s
  22. * GNU General Public License for more details." l, i2 t$ i$ a: F% N  C- G3 t; M! G
  23. */
    + M7 u3 s( e; \1 [9 `9 I( {

  24. ' O) C6 c+ I- F: G4 K
  25. #include <linux/module.h>
    * o( ~& U1 d, f3 ]
  26. #include <linux/init.h>
    " m) e. A; e& [9 x
  27. #include <linux/errno.h>
    6 I2 n. N; o" b
  28. #include <linux/types.h>+ X5 }; @* z- K. j7 s
  29. #include <linux/interrupt.h>7 j' w( j7 a/ _* x6 @, u
  30. #include <asm/io.h>2 k/ r9 B) I6 [2 D
  31. #include <linux/moduleparam.h>$ ^/ S1 d% a( V4 U0 G" R/ D
  32. #include <linux/sysctl.h>3 L! [9 p+ y1 z8 h5 O' W
  33. #include <linux/mm.h>
    ( u* `% T' {: C: Z/ {
  34. #include <linux/dma-mapping.h>( K/ G! ^. e: [' }
  35. ) m2 W& t8 e( y
  36. #include <mach/memory.h>' V: F4 M( V! R/ M2 I9 l1 M5 y
  37. #include <mach/hardware.h>
    ! x+ C) W9 E' X
  38. #include <mach/irqs.h>; W1 ^  ~' S; `
  39. #include <asm/hardware/edma.h>2 \7 w) i, ?# e, K% Q) U; `! o4 e! T
  40. 8 ^2 D8 `7 i  D; |9 t( M; Q5 o
  41. #undef EDMA3_DEBUG9 M8 Q: c. I/ G/ T+ s6 y7 i
  42. /*#define EDMA3_DEBUG*/* c1 s4 Y- O! a# T7 p' O& V

  43. 3 d: S1 ~- a5 Y, c; A9 W0 ]
  44. #ifdef EDMA3_DEBUG
      O1 c# B; P( q% s0 m0 Q& O6 K! E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  c1 a2 K: f4 _, e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), J2 O: ]1 I8 o) Y3 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e/ R2 @& P, V8 P
  48. #else
    6 S/ m" V! Q/ {6 R3 U, W$ L7 Z! I
  49. #define DMA_PRINTK( x... )( a/ d$ M  g8 m" ?
  50. #define DMA_FN_IN7 b. n! H; V: g) Z( `
  51. #define DMA_FN_OUT; c  G; X% [& M  q6 P- ~
  52. #endif6 h4 @" ~' G. P  c+ D7 |
  53. & ]; ?/ W: Q  d1 r7 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( P2 Y+ s3 w, \) C* V1 R  N2 J# p
  55. #define STATIC_SHIFT                3! W, f  s( \2 U( a7 x; a% u5 A. x" N
  56. #define TCINTEN_SHIFT               20% e$ r' D2 m' E2 _; i) ]/ D6 D
  57. #define ITCINTEN_SHIFT              212 H7 D% P4 K/ w  d0 E
  58. #define TCCHEN_SHIFT                22/ c$ A  a3 S# u0 \8 c0 c) a; ?
  59. #define ITCCHEN_SHIFT               239 j  M; m0 ?2 q. v, C  ~3 b$ U

  60. ( P- M$ I, G; ^: h/ z
  61. static volatile int irqraised1 = 0;7 G$ K8 j3 d$ Z- [! R  U
  62. static volatile int irqraised2 = 0;
    9 N( d, J5 _; r  w# u3 t6 y
  63. ' T3 K) X$ a& X9 Y. i1 G9 B, g' i) B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `( p; o) U( F. M0 e2 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ?# d2 p4 m4 E$ L8 s5 q$ e: e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x7 o. h% z' x( }
  67. ! @1 B) b4 R: B) q4 x: R
  68. dma_addr_t dmaphyssrc1 = 0;% g' ?- [' C3 T$ ]5 O
  69. dma_addr_t dmaphyssrc2 = 0;) e& d$ z3 h5 e2 T
  70. dma_addr_t dmaphysdest1 = 0;# a5 r8 F/ r9 A) d# }5 I
  71. dma_addr_t dmaphysdest2 = 0;
    " v0 N; P% \8 J" P% f7 z
  72. 5 Q# i6 _9 z* b. ^" O' V
  73. char *dmabufsrc1 = NULL;5 [7 Z+ R' }; G) }8 j  _
  74. char *dmabufsrc2 = NULL;
    3 y" d. {" [; G' m
  75. char *dmabufdest1 = NULL;
    5 c; [# M0 Y. j0 F- y* D; r
  76. char *dmabufdest2 = NULL;
    3 m3 w) ^! i, M; V% Z% [

  77. 3 y  Y( N$ T% M" Z6 {' s+ ~
  78. static int acnt = 512;
    6 ^8 P& ~  r8 j, Q
  79. static int bcnt = 8;
    $ R" _, V; H$ m* u+ n: R9 R1 I9 Y
  80. static int ccnt = 8;
    & ?. f+ m- B2 N- {" c
  81. 4 Q' Z! p( C4 H# i# X4 i
  82. module_param(acnt, int, S_IRUGO);
    1 U7 Z2 {  c! h. w/ t
  83. module_param(bcnt, int, S_IRUGO);1 a4 z$ \# Q" i% z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ P9 X: y3 J- \( n/ W' X) z- }, G& o. k8 O8 \+ _* N, B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 g. ]) ?' I* ^7 G  {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: G. q; h/ T1 I( a+ E9 ?* P# O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  W) b1 f/ K: _: Z2 x
3 t7 b5 J9 z9 X% P4 C7 b- B7 Q# }) @' V2 g' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-29 22:29 , Processed in 0.043458 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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