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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ^0 o; r# ^* i) }% @/ u
  1. [code]EDMA sample test application
    ) W# e" B4 A, y% o  x
  2. /*
    % U" g7 l% W/ Y) ]- @
  3. * edma_test.c
    ( r5 t3 ~& T$ Z; N
  4. *  g3 D' G2 H. }) O
  5. * brief  EDMA3 Test Application
    # [. ?) }) C* `3 S9 T' `
  6. *
    6 o" N/ C1 n, C) V  P
  7. *   This file contains EDMA3 Test code.- x7 b; J* p& J, |
  8. *
    ; |, T, g2 F4 C+ C( o( E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 W1 U- j+ _8 R& K: b/ [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( H8 D' f: f. ~/ S9 f. ~3 Q; _) v; b
  11. *         TO CHANGE.
    7 @4 j, F* E& q, T
  12. *5 k7 W* D- ]/ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 s! n1 J6 g9 s+ {) r
  14. *% H0 R- V! d2 C4 {1 W
  15. * This program is free software; you can redistribute it and/or1 n& r7 u" r; z
  16. * modify it under the terms of the GNU General Public License as9 i; `' C) J7 u* _! x" j
  17. * published by the Free Software Foundation version 2.
    1 Y/ h) f: J7 ?$ h$ {
  18. *
    6 @* `0 c; T! s% T* t  x' G* G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 D' n$ n( x5 y" H" P8 K) ~
  20. * kind, whether express or implied; without even the implied warranty
    7 Q* Z: ^) q8 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) e; [6 l; A" S) M6 H9 a& r: `: L  K6 A
  22. * GNU General Public License for more details.2 y5 \8 a6 `3 q1 V3 V5 }
  23. */$ \+ ^) h' R7 g3 B2 v) P
  24. & K3 z( z5 Q% b+ i" N5 o
  25. #include <linux/module.h>
    9 K7 z" I# z/ w" Z
  26. #include <linux/init.h>$ |7 M& l' g( q8 e
  27. #include <linux/errno.h>0 K: N! B0 Z# G* x7 t# H
  28. #include <linux/types.h>
    9 j# f  C: s1 N* ~" \
  29. #include <linux/interrupt.h>3 ^: s3 B# R& i, ~
  30. #include <asm/io.h>
    3 B/ `# U2 q$ v! f2 @
  31. #include <linux/moduleparam.h>
    & C& w, B4 M! G$ A' M3 ^% |5 D
  32. #include <linux/sysctl.h>
    3 P# z" {: `. W
  33. #include <linux/mm.h>0 S' Y1 j! ?+ ]8 h
  34. #include <linux/dma-mapping.h>
    6 a( \1 y6 _7 X; O

  35. : p( J6 P2 G8 X
  36. #include <mach/memory.h>
    . @2 h% s6 s* @
  37. #include <mach/hardware.h>- E8 |6 J. N9 Y
  38. #include <mach/irqs.h>& X1 p/ n8 u9 J, I$ d0 f1 E9 o9 U7 c
  39. #include <asm/hardware/edma.h>+ A- a' s5 n. k, u/ j% L

  40. + s9 z! ^1 i3 U
  41. #undef EDMA3_DEBUG& j& r# l2 q. [" j% y8 l3 c& q
  42. /*#define EDMA3_DEBUG*/
    6 X1 ~- s1 U8 j

  43. 9 a. N, R' }8 {2 z' e% Q
  44. #ifdef EDMA3_DEBUG6 x+ {. t* \0 [4 G) P  u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 F# n9 [1 C- o$ E. c' i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Y3 v. c1 e9 i8 J( n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 h6 G, Y* Q' u3 E8 U( w/ m+ t% w9 O1 R
  48. #else
    . _/ u, Q0 Y! I
  49. #define DMA_PRINTK( x... ); ~' z# {8 }* N' C# F, F
  50. #define DMA_FN_IN. C$ K, J$ I- U1 }, P7 m  h; {
  51. #define DMA_FN_OUT
    4 _- `: Y, E, o3 X8 v1 z9 N
  52. #endif
    5 `" a9 G9 x* D) {
  53. : q- p8 l* w  V: A6 m% b9 A2 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 x) |' y2 Z$ e' B" Y9 {
  55. #define STATIC_SHIFT                3
    7 \1 u( Q1 _2 @* v2 a" F7 v& p
  56. #define TCINTEN_SHIFT               20
    , K" G  F' h. V/ t& T8 G# U
  57. #define ITCINTEN_SHIFT              21
    4 N# R: C( L0 O" R& p5 N3 F% m5 i
  58. #define TCCHEN_SHIFT                22
    . O' v1 d$ z! q/ a- h1 D8 T
  59. #define ITCCHEN_SHIFT               23; \( H: A% t3 k1 q& W) ]" M
  60. 5 I5 t, q4 N- C' l1 u' T
  61. static volatile int irqraised1 = 0;
    : L7 p& E$ m9 n5 H0 T# R# G
  62. static volatile int irqraised2 = 0;
    4 P' G6 G* F* I7 ^* Q) b) W
  63. ( E7 i& ~7 Y+ _+ a4 _" Z( x2 m/ v2 G3 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R9 a: G% ?6 P" u$ n/ e  ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |' j8 p4 Q  W# G: o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ z2 w2 F  N: \: l4 @7 S/ X' I. O0 G

  67. 7 h( U4 S: l7 e! l  m
  68. dma_addr_t dmaphyssrc1 = 0;
    8 K' K; p+ l: v6 F/ T) D6 d
  69. dma_addr_t dmaphyssrc2 = 0;
    8 N% W! |% b+ k
  70. dma_addr_t dmaphysdest1 = 0;$ s$ {& X; ?( B+ w
  71. dma_addr_t dmaphysdest2 = 0;
    " v; f8 s; Z  X

  72. 9 ~) c" r) {% i) e1 ]5 E; g
  73. char *dmabufsrc1 = NULL;1 C. m* |( P) i0 i
  74. char *dmabufsrc2 = NULL;
    5 [2 U: }% U1 C, X7 R+ Q$ G1 Y
  75. char *dmabufdest1 = NULL;; @! S: s) i) q3 g5 Y% G
  76. char *dmabufdest2 = NULL;! b6 Z6 Q1 ^: z

  77. 9 L4 b% |! I, o$ Y# r: _5 C
  78. static int acnt = 512;8 y* t- X9 Q7 g7 I% X
  79. static int bcnt = 8;: `4 x5 a% d- z0 Y9 D& c8 D, p8 R
  80. static int ccnt = 8;: f/ s0 P# U3 h- b, K3 v8 C

  81. + L/ W/ f+ C  {- B
  82. module_param(acnt, int, S_IRUGO);
    . [) W! q0 @/ h5 ^& H2 G
  83. module_param(bcnt, int, S_IRUGO);
    ; ], W. F& e. c; _; W$ @6 z- c* D! {2 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" t8 b/ Z4 k( w0 @# I0 X

1 ?3 C& v( C( R+ a8 Q1 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- M) d! G. \* [) z' barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 B. l3 {# u$ K8 }. e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' x3 N# y1 ]/ v6 N6 [8 k, W2 t  q" y! p' ^( T  \* K9 \7 w

/ ?: O$ n5 j# c) v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 06:30 , Processed in 0.039431 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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