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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o) c8 b$ S/ d, Y, L
  1. [code]EDMA sample test application
    1 `4 B# f: V7 C6 t7 y
  2. /*$ e7 o6 s' `0 x3 y, X' E) @
  3. * edma_test.c
    - H- [2 `9 x( `5 ?4 }: p* |# U
  4. *# z$ d# f, Y2 n. x" [
  5. * brief  EDMA3 Test Application$ F7 o, X& d! y* X' P4 d: [
  6. *9 O) l: H1 E7 _2 K& B. m
  7. *   This file contains EDMA3 Test code.* V  c0 `/ k9 T' m( r" ~
  8. *
    : ?3 n8 V& {9 V+ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( A! B  R, n' j2 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% G# Q" v" L4 `0 K! u
  11. *         TO CHANGE.7 e9 w% h$ f8 @. w9 i, m7 X8 N
  12. *6 s' @$ P1 d6 d. v6 H+ u" j& y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 F5 {& |  H/ L  i7 D
  14. *) _* t  t- f8 x) O
  15. * This program is free software; you can redistribute it and/or
    5 d- [8 t* {- O0 Z+ s+ T
  16. * modify it under the terms of the GNU General Public License as
    " q$ w7 X  F: ^  l- |6 q
  17. * published by the Free Software Foundation version 2.
    7 y/ H7 R5 S1 B, @% I
  18. *
    " t4 @5 {# l; d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) A/ W4 x& E' z7 O4 ?- i! `* B- x( Q
  20. * kind, whether express or implied; without even the implied warranty
    3 p$ X8 W! g6 J- F& ^0 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % D, R+ J1 q. o2 s
  22. * GNU General Public License for more details.
    ! V) g7 F9 s' q
  23. */
    " o/ Q6 e9 c7 Y! \% Z9 F8 V

  24. ; J) i4 i7 W* z3 ^4 m8 e* d5 T
  25. #include <linux/module.h>
    5 T9 @3 g$ N# b: j$ V. p, d
  26. #include <linux/init.h>/ ^4 a; e& G  m) c: B" _7 S
  27. #include <linux/errno.h>8 J+ s$ _' l% i
  28. #include <linux/types.h>
    4 M7 d0 p! r9 W8 x2 d2 e
  29. #include <linux/interrupt.h>  v8 j2 R. p' l  H6 K9 @. U
  30. #include <asm/io.h>
    1 J& ^, G2 |# ^& k' F/ l0 o
  31. #include <linux/moduleparam.h>  R0 r/ o3 g& c2 S. M
  32. #include <linux/sysctl.h>
    . }: z5 t- k: E
  33. #include <linux/mm.h>: b! s1 H! l% I
  34. #include <linux/dma-mapping.h>
    : T& ]' D/ ^4 t; r
  35.   T# i- ]7 m3 B( ]" L; F
  36. #include <mach/memory.h>, |2 l9 y: U7 h0 X
  37. #include <mach/hardware.h>7 |& f$ B- F! I4 V# K9 ?* ?0 b8 b
  38. #include <mach/irqs.h>
    3 R* I! ~, D" _# N* w" S: o
  39. #include <asm/hardware/edma.h>8 x$ w* W2 D5 N& W' |

  40. : |  Z7 E. B& P0 O3 l
  41. #undef EDMA3_DEBUG$ K. @  H, b- w) i; \* V: L
  42. /*#define EDMA3_DEBUG*/* N+ L: |. u  ^8 i

  43. % R7 r6 d7 a# {0 v, o
  44. #ifdef EDMA3_DEBUG
    # ?' V1 j" m. t9 z) b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 p  L! u9 Z, C5 a" @' P: {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 B8 |/ u8 T; s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 J0 F& g7 ~. r8 T" D
  48. #else
    / \- b% e& u! _5 H8 m) o
  49. #define DMA_PRINTK( x... )
    6 u8 E: d8 U( _1 Z# K! n
  50. #define DMA_FN_IN) c9 `5 \& z- H  h/ ~& `% c, ^. V- X# {
  51. #define DMA_FN_OUT
    " z4 d( v8 |0 ?# Z0 ~% G& R& d8 o# ]8 J( ^
  52. #endif) r( [9 C( Q3 U% s: v
  53. 6 w, x4 t! n8 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# G* B1 M7 p9 A
  55. #define STATIC_SHIFT                34 ]. o; J% [1 s# |" `0 {
  56. #define TCINTEN_SHIFT               20
    " D! n. ~- C# _
  57. #define ITCINTEN_SHIFT              21$ d$ u; A5 V- G  B1 Y9 E) K$ B
  58. #define TCCHEN_SHIFT                22
    8 j. H% q+ H0 e9 r# d, T; {
  59. #define ITCCHEN_SHIFT               23
    , V$ p: K4 R' c+ g+ A" [
  60. 7 E6 ^  Z. o! I
  61. static volatile int irqraised1 = 0;
    + g/ _7 v) c& C/ P7 F4 j  x
  62. static volatile int irqraised2 = 0;
    + ^# l" w9 C9 U  |* p  P; d
  63. & C' q/ H2 \- G3 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, \1 a: p, m1 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n5 t8 v1 O; m7 e/ b5 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y% S% [( S  J2 b
  67. 8 {9 M" I8 l3 H  X; U
  68. dma_addr_t dmaphyssrc1 = 0;
    1 a3 r0 M1 ]' b6 v
  69. dma_addr_t dmaphyssrc2 = 0;; f- N' t* Z+ I6 `( d% v
  70. dma_addr_t dmaphysdest1 = 0;* R- C8 Y7 N1 W+ Q& m
  71. dma_addr_t dmaphysdest2 = 0;" U, d5 v" S& \# f, j- W# l- O

  72. # J/ l2 q! A: G! k4 o3 q
  73. char *dmabufsrc1 = NULL;) W# ]) F8 ?3 ]. J
  74. char *dmabufsrc2 = NULL;- R; @2 E! S4 L- S
  75. char *dmabufdest1 = NULL;
    4 u3 D6 `; k' w7 X1 F1 w# p' @$ ]
  76. char *dmabufdest2 = NULL;" N- `% ^9 M* Y5 d5 \7 i

  77. " R6 n; F! @2 W
  78. static int acnt = 512;8 m7 O! J( P& v) o, g4 ?- ]! g" r8 t* q
  79. static int bcnt = 8;
      J, }, ^% \) }0 ~% ]3 c! t( A$ E
  80. static int ccnt = 8;
    . }9 K6 n/ x, _7 P# L# H3 N
  81. 1 i' x  g" ]! \/ T  I
  82. module_param(acnt, int, S_IRUGO);
    * X, ?/ }  O0 s& V* s
  83. module_param(bcnt, int, S_IRUGO);
    2 \2 w" T  g- c1 V, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- }# B% K$ O* b$ m+ b1 @
  m3 b' A) g- z, R% n4 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v* o+ @( `7 g) d  h6 M% ?: Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- F1 \( B6 ^( P% }8 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; y  B8 B2 b2 x& c5 s5 _6 v( b
8 m$ l2 l9 Q" X0 h, }) _
0 c( i+ p$ r# f( K1 H; o" R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-25 07:13 , Processed in 0.042115 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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