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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 I+ P5 J) v! m, h1 @
  1. [code]EDMA sample test application4 a2 ]! P8 v/ k9 G2 y
  2. /*
    1 f% h# q0 l7 r! j2 r" p
  3. * edma_test.c
    - I* F& p! z8 X
  4. *3 M) A$ y& M% G8 f; r, h
  5. * brief  EDMA3 Test Application
    ) L) a, a- |& r2 G0 J( P
  6. *- h2 o' F4 f1 s  H+ C& `* N1 k: P
  7. *   This file contains EDMA3 Test code.
    7 l( H5 ~7 b6 v9 z
  8. *
    * m$ B" |: I. o6 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r" d+ h( j  C% g' ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' @, s+ ]1 _6 y$ a  T) ~& s2 ~* ]/ c3 m
  11. *         TO CHANGE.
      G' M% {  |8 G, r: k. l" Z! c
  12. *" S# l6 h$ ~" l0 u2 z3 m0 ^, j; g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ^4 _. {4 r" L
  14. *
    - b" ~  x& r# ~  O1 P  t
  15. * This program is free software; you can redistribute it and/or; Y- \5 R! p" l0 s+ M9 j8 p
  16. * modify it under the terms of the GNU General Public License as! R; O& C5 ^$ \. O9 ~
  17. * published by the Free Software Foundation version 2.
    4 [. s4 r( }( e$ g1 a
  18. *3 h+ w8 h  X3 |; q, X% ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* k& j! |$ `1 {2 C' C& p
  20. * kind, whether express or implied; without even the implied warranty
    ; E: v9 I. ?: L* i) ?' [0 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) A& J: N) E+ n6 ~4 s  x
  22. * GNU General Public License for more details.
    * T/ k9 i# B$ ~( u/ N  j& S3 Y
  23. */
    $ w5 m* G* h* G  N

  24. * i* _2 K6 m. a$ R+ S- J1 ^4 b- z" e
  25. #include <linux/module.h>
    ; i" {1 K' ?, a4 D& ~  C
  26. #include <linux/init.h>
    * K  h. ~( Q- N8 Q- D0 Q9 s% y
  27. #include <linux/errno.h>. u, x' ^: w. |
  28. #include <linux/types.h># g- H1 Y% }3 }6 R
  29. #include <linux/interrupt.h>
    - ^2 `* O. N, M5 y! A+ }
  30. #include <asm/io.h>2 f; F2 ]& R* f" K
  31. #include <linux/moduleparam.h>0 z; e" e/ e8 X4 x6 z
  32. #include <linux/sysctl.h>7 d% m! V. _+ a7 f
  33. #include <linux/mm.h>
    2 h! r( [( K! N9 }
  34. #include <linux/dma-mapping.h>
    3 J5 X5 d; E4 h

  35. 8 |3 ^% O/ y; s; ]3 w! e  v
  36. #include <mach/memory.h>0 }; ~4 ~$ Q* q
  37. #include <mach/hardware.h>
    . S% n$ V& J0 L8 t+ q2 b" i
  38. #include <mach/irqs.h>4 r; |' y' t& m, U( D
  39. #include <asm/hardware/edma.h>; _- I& Z) Y, `! T: O; x) g
  40. * e/ ^4 E3 L' E$ U
  41. #undef EDMA3_DEBUG
    ; U* k: @2 x. C; x: _
  42. /*#define EDMA3_DEBUG*/
    ( _+ M# a* r7 ~( \+ e' l
  43. 0 i  b. }! P, [" @% z& Z
  44. #ifdef EDMA3_DEBUG
    , V* C1 @* _2 z+ t5 J7 |2 l0 D9 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : [; t* i5 i; M4 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) s# t# o: Q+ `" z- t8 @# h6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 F. h* R1 j% C' [" C
  48. #else0 B, p8 U5 u1 m! D7 K8 p& @) _' k. J
  49. #define DMA_PRINTK( x... )# H( y4 j" y/ P
  50. #define DMA_FN_IN1 d# Q0 V- V: O& t& I. D" h0 D
  51. #define DMA_FN_OUT
    4 r- {. K: c/ W# B/ Z. W6 U/ b
  52. #endif
    $ r1 g9 [( i8 ]& Y; h
  53. ! I3 Y9 S+ Z& L' @7 d! P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 S6 V8 i7 `! r, ~, j* H# S
  55. #define STATIC_SHIFT                34 H- m% G# m# v* S0 f
  56. #define TCINTEN_SHIFT               206 r5 f- f5 @: q
  57. #define ITCINTEN_SHIFT              21- }: ]! P( I4 l' G
  58. #define TCCHEN_SHIFT                225 y. t% J) J* F8 G
  59. #define ITCCHEN_SHIFT               23
    ' X, K) c& q/ m" x9 {9 C6 J4 K+ p7 Y

  60. 9 R, `/ k8 t4 q* F0 c
  61. static volatile int irqraised1 = 0;
    8 d* |; B' K! x; L% f
  62. static volatile int irqraised2 = 0;  X2 @" R9 A3 n  `- o

  63. ! q" k. w9 _2 D1 ]9 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F% ]0 N; Q' E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 f+ S: Q0 p; O( v0 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^) C4 u% `4 `+ B& P: f
  67. 9 \' }2 N" w. r& [9 Z
  68. dma_addr_t dmaphyssrc1 = 0;. |7 J# ~8 z' I/ u" I% @
  69. dma_addr_t dmaphyssrc2 = 0;
    ) F! ^/ z' I8 A
  70. dma_addr_t dmaphysdest1 = 0;
    6 {. H+ v& q( {' n2 m# O
  71. dma_addr_t dmaphysdest2 = 0;
    2 R7 ?- Q7 {8 W6 n- G% q

  72. 2 c4 X2 q6 [- `
  73. char *dmabufsrc1 = NULL;
    , g& s# t# r, a# [$ m
  74. char *dmabufsrc2 = NULL;0 _0 s+ r# @$ K
  75. char *dmabufdest1 = NULL;
    . ?  |7 K& i1 A3 }# t
  76. char *dmabufdest2 = NULL;( }* ~+ ]) s  s9 M, i1 H

  77.   ]8 o3 A+ e; j5 Z5 x7 n
  78. static int acnt = 512;
    ! C. p& q$ r0 S* R0 U5 a
  79. static int bcnt = 8;
    ' r  l& q# x6 S+ p! s- P8 L6 w2 s
  80. static int ccnt = 8;
    : @$ j) ?6 [# I: N0 N2 D

  81. 8 X7 A0 x/ O2 P- T% ]# F6 y* i
  82. module_param(acnt, int, S_IRUGO);
    6 Z: ?) Z) T) v- [4 i1 e* @' _9 o
  83. module_param(bcnt, int, S_IRUGO);
    $ {/ q8 s: H) U: X' o3 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  L" J* a# z! I4 ]% D

# Z* ~6 Y* G$ F  @" j, f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Q1 T" Y1 o0 n# G* ~6 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R: }( i; v  |# v' W# L  `* b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 z- w2 Y% q+ @2 v0 a: K2 z) E+ K0 w0 e2 I2 ~# l
% u8 L7 a$ D; @9 v  h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 17:26 , Processed in 0.039000 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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