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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N- V/ q# @9 |: e; j8 x
  1. [code]EDMA sample test application
    ; }& t1 z, U! V! Q- X
  2. /*
    9 ^) H& _, r3 [+ K1 @) t& l4 N
  3. * edma_test.c" O, x- _6 s8 q4 {' a& f
  4. *
    5 o0 c! h) S2 y! _! o, ~3 |
  5. * brief  EDMA3 Test Application
    : I' v1 P  c5 M# e
  6. *
    ( n1 N9 J  n8 }
  7. *   This file contains EDMA3 Test code.' z  V0 s, B+ A
  8. *7 l0 g6 g! E$ f' k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% t  s5 n/ Z1 P; U) y( Y6 g0 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W$ R8 o" X) n0 p5 s4 r
  11. *         TO CHANGE.2 h* R9 W6 N3 N' q4 K% f
  12. *0 s! Z) N9 [. s; H! x" V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ?6 Z' y; h3 P/ u" p( I
  14. *9 ~+ U! `, ~# l8 H: r! {
  15. * This program is free software; you can redistribute it and/or1 {- p9 b9 P  ~0 k( Z& H" U" T0 F$ d
  16. * modify it under the terms of the GNU General Public License as
    6 C6 i8 n! L. X! K
  17. * published by the Free Software Foundation version 2.
    6 B" }' W% p6 A, ?
  18. *2 h# |. L4 {2 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  [, f9 d1 }% \2 O
  20. * kind, whether express or implied; without even the implied warranty
    ; M! V! Y7 H' l# n6 T3 ?$ S& _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 H) ^& N3 \! V5 h& P
  22. * GNU General Public License for more details.; @. o8 ]! R1 ^' a
  23. */; Q; }* j& t( i+ L$ ]
  24. ! v& [2 C3 ?9 P' E9 M
  25. #include <linux/module.h>
    4 C4 y/ P9 X+ A% A1 r8 o
  26. #include <linux/init.h>
    ; {# F0 M+ j) F5 ~$ P1 \7 @
  27. #include <linux/errno.h>
    + }: T7 }' ]. v) _
  28. #include <linux/types.h>
    2 T3 Z+ E+ F8 [
  29. #include <linux/interrupt.h>
    3 o6 @8 F/ V% _9 i$ x4 |
  30. #include <asm/io.h>
    1 m1 `2 C6 s! R, ~8 E
  31. #include <linux/moduleparam.h>
    1 @/ v+ u1 J4 {( K* X
  32. #include <linux/sysctl.h>
    5 m/ D! l# v$ {1 Q. j/ a* i
  33. #include <linux/mm.h>& r! k7 c1 A& o- r; ]
  34. #include <linux/dma-mapping.h>+ q4 ^' @0 X: B: f: z3 V
  35. 2 s3 V0 S6 F4 u2 a5 `6 K6 ~4 d
  36. #include <mach/memory.h>6 K* S9 \  N( R2 M/ F# ^" W
  37. #include <mach/hardware.h>
    5 }* g  X4 z1 k
  38. #include <mach/irqs.h>* m$ p2 J3 W, _$ D" [
  39. #include <asm/hardware/edma.h>2 [$ G, m6 k" C7 x3 s* T

  40. % u: _! {8 [  b* _/ Q/ n. K( y
  41. #undef EDMA3_DEBUG- x9 S8 L7 Z( C$ @/ F' N- w
  42. /*#define EDMA3_DEBUG*/
    ; ^6 r+ W: D* x
  43. % @( e% _  s5 m' a
  44. #ifdef EDMA3_DEBUG  ^; G  U  C9 c* k( C; p3 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T$ R1 v/ b. U' i4 g7 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e6 ?; ]5 q) ?4 y1 ]4 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " K% D6 c4 K5 u" B2 |
  48. #else- g2 W6 M1 d  O8 D2 n
  49. #define DMA_PRINTK( x... )
    $ H4 C, ?4 I+ {' ?; e
  50. #define DMA_FN_IN/ G$ E' O$ [' G2 m! ~( _
  51. #define DMA_FN_OUT) G6 I! t! b9 Y. x
  52. #endif' k8 i( A: W8 D/ u! l* N$ U/ f0 \
  53. / S8 i3 x) `5 d- L" @4 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 [) i! w* x; S
  55. #define STATIC_SHIFT                3/ i& m. q2 L7 |' _* b+ w
  56. #define TCINTEN_SHIFT               20$ F* O& S; j6 y1 X5 S
  57. #define ITCINTEN_SHIFT              21
    0 M0 V  k, g! y/ S7 a# p0 C
  58. #define TCCHEN_SHIFT                22
    + e2 U& ?8 G9 |
  59. #define ITCCHEN_SHIFT               23
    6 U" O0 q# S* b- J: |9 |; g
  60. % U! h" O. v1 ]: g, d
  61. static volatile int irqraised1 = 0;
    + p- X% y$ S% K* T# b$ ^- a
  62. static volatile int irqraised2 = 0;, W. P- Y: C: T: y; i3 k$ T: y. o7 ~. c

  63. ' |5 Q' z# l, h* `. s( E2 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ]2 w. ?' B0 F+ Y: g2 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _. _& k0 g/ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 l' s! G% F# N6 t% _

  67. 6 p& ?( I4 }( n$ Z2 r" C4 Y4 D, T+ I
  68. dma_addr_t dmaphyssrc1 = 0;. L* k$ y, X; q+ s) O1 Y3 z9 T  ?
  69. dma_addr_t dmaphyssrc2 = 0;
    9 F$ V! I" p9 g2 x6 u; i3 L9 [
  70. dma_addr_t dmaphysdest1 = 0;( I6 R: t, v. i) v6 X7 t
  71. dma_addr_t dmaphysdest2 = 0;% z2 W# W8 r, z. d1 J* M
  72. / {- A4 a/ S2 O2 D' |
  73. char *dmabufsrc1 = NULL;% z8 R. Z# A9 z* V7 g# f
  74. char *dmabufsrc2 = NULL;5 \1 M. f8 Z  w* d: o
  75. char *dmabufdest1 = NULL;! E* J3 I5 g6 P! x. g; c6 s
  76. char *dmabufdest2 = NULL;
    4 M  I3 R6 ^" c$ H

  77. # M# Z7 m8 e  ^3 Y
  78. static int acnt = 512;
    / }3 y6 W. N3 J
  79. static int bcnt = 8;; |1 p6 f5 d" ^: }& x* r
  80. static int ccnt = 8;
    ) G2 y2 h1 L- f; g
  81. ! q0 {( k: Y/ \3 V
  82. module_param(acnt, int, S_IRUGO);. J1 {, t9 d& I3 j6 r; v% a
  83. module_param(bcnt, int, S_IRUGO);9 c! K2 `; D) T. m* `8 L* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 ^; c: O1 t7 p. T

  I$ T, s  e# t) {+ w% Z  U. M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% E  j4 S( h4 c! E' ^  P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p; A" U& C( P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 _/ E9 y3 K& \' p- i, N5 |" `
6 G. O; G9 Y7 E3 U+ a* M

: |" B3 O- Q1 ?- B2 O( `* s+ }  k% w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 01:29 , Processed in 0.038443 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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