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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& P" f' ]5 i9 r8 F6 b+ E. ]( p
  1. [code]EDMA sample test application
    0 I6 N( D1 }9 A& x5 y3 H/ `
  2. /*
    0 D" A  b8 [6 Y* B
  3. * edma_test.c1 x! F& J5 E) _! R4 r  ]
  4. *
    2 ?* c, b* o% B
  5. * brief  EDMA3 Test Application
    6 ?' L+ }* D5 a; |# X. C; p0 G: o$ k
  6. *( l1 F# [& r" g
  7. *   This file contains EDMA3 Test code.* Y. }: e- P* E. q9 Q- F
  8. *! q' D" w5 `0 V/ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % I/ |1 t2 |  b+ @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W6 K0 e) ?/ m% A
  11. *         TO CHANGE.2 P# V% b4 v2 y6 q8 Q+ o
  12. *
      b) ]+ f' b0 I% M* _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( Z2 Z6 p! `  X/ ^/ C
  14. *0 \' O$ `4 X! I! c
  15. * This program is free software; you can redistribute it and/or
    ; H1 Y: R# r7 x% [5 B# o& A
  16. * modify it under the terms of the GNU General Public License as
    3 y% W0 p% z( O4 l" e
  17. * published by the Free Software Foundation version 2.8 A* b3 V( h: Z( A0 L, `
  18. *8 X6 c! ]$ A0 _, q& y! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) c9 w! u6 v# t! S8 t* F+ Z; q* ^( ]
  20. * kind, whether express or implied; without even the implied warranty
    " g* ]6 q& v$ L, o% J" y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 W9 O( h" W% k. i) y# @% d# r
  22. * GNU General Public License for more details., X2 M& X* x+ W; r+ Z
  23. */
    % D; K# y1 v' [& p; ~* x" _  r
  24. 3 h6 _2 n! g% V1 a1 e! }
  25. #include <linux/module.h>
    9 p- h8 I; O7 m& J6 s* N
  26. #include <linux/init.h>
    % Y: }! L# ?. k/ ?: r- I8 f& ~
  27. #include <linux/errno.h>* t; V; ^0 V: i( W3 g
  28. #include <linux/types.h>/ C% \: S- [7 v6 ^9 u8 q
  29. #include <linux/interrupt.h>1 B, }7 |2 j% x
  30. #include <asm/io.h>& i# P, S) r4 I7 A  }( ~3 |
  31. #include <linux/moduleparam.h>
      z: S+ z+ g$ ]  k
  32. #include <linux/sysctl.h>
    / Q2 a# ]' ^9 x( V: B2 Q
  33. #include <linux/mm.h>5 R0 |! m! V% W; U# F) m5 v
  34. #include <linux/dma-mapping.h>
    ) f/ Z# H% a# g- k

  35. 1 o- q% B/ i# g) N) e; V& h! r" P
  36. #include <mach/memory.h>; g* P. ~/ d) w% i* w
  37. #include <mach/hardware.h>3 q, P. K' s% ]4 W1 O, A$ {  s* ]7 U
  38. #include <mach/irqs.h>- W7 `) ]# C9 y: P
  39. #include <asm/hardware/edma.h>
    0 z; e0 g3 O5 C4 x# E
  40. 1 E8 x$ m9 w" k8 K$ Y% T  a  G
  41. #undef EDMA3_DEBUG: f" `5 G9 m: {3 x" k* a
  42. /*#define EDMA3_DEBUG*/) Q' r% W) F# U/ j
  43. ) K+ c# M2 J$ S; Q! [, @
  44. #ifdef EDMA3_DEBUG
    8 G/ w% C# @1 k) `& ]8 o( ^" o. v% q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # R8 _1 U& x( q% R3 T3 N9 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 P8 p5 C) n, N% b* n1 o) r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 w" z2 ?  C7 ]' v! A
  48. #else# Z3 y1 r/ y' ?: s6 D. s& X( ~7 ?1 }5 d
  49. #define DMA_PRINTK( x... )" f. K* ?: h3 a! Q. l8 g: C
  50. #define DMA_FN_IN$ Y6 v5 o: Q% K8 B0 n' L$ p* v2 j( P% m
  51. #define DMA_FN_OUT# P1 t" ^+ e3 \: P, I% {" q
  52. #endif7 T4 M. e# U: j' V8 ?. i8 \; E( ]
  53. 2 w6 g. y! J- S: A4 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 L- T5 H' c* |& j1 [
  55. #define STATIC_SHIFT                3& u, I' p, y, N: K/ j/ J3 G
  56. #define TCINTEN_SHIFT               20
    # J! A+ {" `2 m, H
  57. #define ITCINTEN_SHIFT              21
    + r9 n$ ~" l3 f
  58. #define TCCHEN_SHIFT                22+ y4 M" f# j9 i  m+ R8 q* m
  59. #define ITCCHEN_SHIFT               23, T( t7 A% I2 P- @! I
  60. ! A3 [6 ?2 {4 ~2 ]# ]0 s6 e7 c
  61. static volatile int irqraised1 = 0;$ D* s% N0 N& B: i3 X
  62. static volatile int irqraised2 = 0;
    % x2 p6 l" L( q
  63.   B. p1 K8 u, _3 L0 W; x% ]6 P. M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' R. _* N2 q0 X7 J1 @+ S0 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 {, L; J: O7 H4 V9 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' |6 P! c) j' ]' n5 U7 u
  67. ( O9 ~1 w; U9 r
  68. dma_addr_t dmaphyssrc1 = 0;  G- V2 b1 b/ D- [; X
  69. dma_addr_t dmaphyssrc2 = 0;, h! ^, K$ o1 I8 p1 c" u: C0 |1 _# E
  70. dma_addr_t dmaphysdest1 = 0;% I+ F0 r9 \8 w5 ~* o0 o, `
  71. dma_addr_t dmaphysdest2 = 0;
    . p+ B" Z: m' L! Y% y6 _/ w
  72. : {' a( w6 Q: O
  73. char *dmabufsrc1 = NULL;, b2 A- q. x! }) t, ]: F1 `- w
  74. char *dmabufsrc2 = NULL;: y% ]: G  f! t
  75. char *dmabufdest1 = NULL;! S. ~! X4 w1 I/ }
  76. char *dmabufdest2 = NULL;
    ) V1 b! ]' d+ b2 l6 o  Y

  77. 8 G  A4 t5 V$ X- @2 ~
  78. static int acnt = 512;) n5 z- D; b5 r% C0 O. _
  79. static int bcnt = 8;
    5 Z: X) Y- _5 K$ Z$ F  c
  80. static int ccnt = 8;
    4 i0 c! D; \- d- A7 [

  81. $ l' Q: \* l9 L/ P" [
  82. module_param(acnt, int, S_IRUGO);
    : I& q* T9 x  Y" F. f" \. M
  83. module_param(bcnt, int, S_IRUGO);/ |6 E, b. I) K. O; l7 |5 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 L' U; T% T  G+ ?7 r) D
2 n. G; k) F% Z6 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ y: w5 e( R% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 N7 z0 M8 j5 f" w5 \: N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, k5 m$ Y* N! a' `. J
6 D/ |/ A2 {' e$ Z( T  S
! G. n4 _8 w7 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 14:53 , Processed in 0.038331 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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