OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - w! Y2 {. r! u  B" k4 A
  1. [code]EDMA sample test application
    3 L% b2 w4 R4 R" y+ @
  2. /*0 J: }9 {# _3 R% R$ O" h
  3. * edma_test.c1 v9 g! X$ W/ s( U# G6 v
  4. *
    ' C( j6 x9 s' ]; g4 _5 J% D2 D* p
  5. * brief  EDMA3 Test Application+ L3 m; ?# a. N/ r0 A' D, X
  6. *
    . X8 B( {) t0 H7 I" w8 _: ]; s
  7. *   This file contains EDMA3 Test code.
    4 C/ t1 O2 C4 v9 [& V
  8. *
    0 i" r: K8 Q/ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ w; A) t; Z3 _) r8 [! A$ v- f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! W7 s* W5 B' E& ^
  11. *         TO CHANGE.
    & \7 n! z+ u! z" \3 M
  12. *
    + w. L/ g4 L  f' i+ y: A5 I0 c' A& }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  {3 Z% S, d# S) V6 [! m
  14. *
    # g3 n# g* b! l6 A6 `* @+ |" B
  15. * This program is free software; you can redistribute it and/or  `* O4 Z* a, K  D
  16. * modify it under the terms of the GNU General Public License as
    1 N+ T# z" k! p( w
  17. * published by the Free Software Foundation version 2., U) E% E/ h# B
  18. ** l5 X* s% R8 Q2 P) X7 O- N) s# S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 @+ i$ B+ C! X: d
  20. * kind, whether express or implied; without even the implied warranty
    % V/ A- M- F4 w! ~. ?3 c: F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: b  o" x$ ]$ X1 t
  22. * GNU General Public License for more details.
    ; ~- P4 q! A) F; x+ ~% t
  23. */* I( P6 r5 q" c) K7 N
  24. * }, ^* o2 \3 |9 j6 L8 o
  25. #include <linux/module.h>6 s  c: g8 T8 H1 T
  26. #include <linux/init.h>
    : k' ^/ @+ V; c7 @* h9 t. Q6 `
  27. #include <linux/errno.h>
    $ C& Z, G6 ^  k5 l0 }4 F% ?# X& r
  28. #include <linux/types.h>
    1 L+ G: m8 }7 P) {6 t% W4 M
  29. #include <linux/interrupt.h>
    # b5 p2 W- }: g
  30. #include <asm/io.h>& P) a9 I3 q9 [6 g8 F
  31. #include <linux/moduleparam.h>
    8 J% \: ?* c7 O
  32. #include <linux/sysctl.h>
    . Z/ i0 J  r7 c1 }, n8 c
  33. #include <linux/mm.h>4 l/ g: A- }( x" M
  34. #include <linux/dma-mapping.h>! S" b0 U; f" B  W! C, g
  35. + L2 h  z. E+ ~/ Z, A- `9 b
  36. #include <mach/memory.h>
    2 U" m# o$ l  N
  37. #include <mach/hardware.h>0 c: r( I8 D! C6 X& j7 \
  38. #include <mach/irqs.h># l- l5 Z) y7 g0 l( P5 ~- S  V& M
  39. #include <asm/hardware/edma.h>" X+ \: L% Z; h' `8 a$ V$ P8 o& P
  40. ( y% F: b% \. F& S$ t' l$ s
  41. #undef EDMA3_DEBUG+ _% {9 b  s! [6 ^9 R* K5 @; L& l
  42. /*#define EDMA3_DEBUG*/: c+ ?. L: d: V
  43. * h: v# @4 x  C+ w" N
  44. #ifdef EDMA3_DEBUG( X2 T( E1 x% x, Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @8 M* l+ K4 M* u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" `! X+ q' j' ~, A9 P. [" G- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i+ k: M5 m( K1 x
  48. #else
    1 Y' g  n4 [0 J- S- m; X% ]$ F5 T
  49. #define DMA_PRINTK( x... )& f* d! q( s- B, D
  50. #define DMA_FN_IN* X6 H& Q, j* b2 I  j6 u0 n+ }( f
  51. #define DMA_FN_OUT
    . S0 r9 U$ ]1 |" F
  52. #endif
    & E% X; h4 \. u* M
  53. ; J. h0 l' N, Q. f, q; v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( ]+ p3 [2 ?$ y" P  |" k+ g* |
  55. #define STATIC_SHIFT                3& |- G! q. h8 D; ?/ E8 b
  56. #define TCINTEN_SHIFT               209 x! m+ O) g( |( f
  57. #define ITCINTEN_SHIFT              21
    + G; I6 T- ]% M# f( V; o
  58. #define TCCHEN_SHIFT                22# k3 A, O. @, I1 c- M
  59. #define ITCCHEN_SHIFT               23
    0 c7 g+ y+ A" ?1 i0 B9 i, y
  60. # B0 [4 d% K( a- y7 D. a
  61. static volatile int irqraised1 = 0;
    ' o% B3 g# [+ S! g
  62. static volatile int irqraised2 = 0;
    6 F. N# O9 |' s
  63. ; m4 S  C: ^8 X. |" W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f  ?* W: p8 R2 f( \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X' j5 ]: d$ ?1 |$ L) O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " g8 e1 F- g+ F% f9 L

  67. 8 t$ ^0 ?) V: j  Q0 R% d' c0 O
  68. dma_addr_t dmaphyssrc1 = 0;
    , e! t3 D( ?3 g8 [4 \; ^
  69. dma_addr_t dmaphyssrc2 = 0;( q: X7 n# q4 ?3 N) t
  70. dma_addr_t dmaphysdest1 = 0;
    , O7 S5 Y7 d3 e1 m" Z2 A8 Z: N) I
  71. dma_addr_t dmaphysdest2 = 0;
    3 R/ B+ v0 i- _0 s1 f5 C( ?8 k' G
  72. + e# ?; e( @" s$ v
  73. char *dmabufsrc1 = NULL;4 I/ K* O  |1 r8 c; X6 c2 E
  74. char *dmabufsrc2 = NULL;  m" [# T' {' u* o
  75. char *dmabufdest1 = NULL;
    % T' C/ F1 J' y; a" y2 v9 w
  76. char *dmabufdest2 = NULL;4 m- u! N7 N' F0 p, `0 R* ]) w

  77. , }8 I2 T/ M5 l; D$ H" m
  78. static int acnt = 512;
    : p# a  ^7 x5 J/ w6 e9 T0 o# }2 z  _
  79. static int bcnt = 8;2 f  f4 ~* v( `: ~! {& D+ b* M+ @
  80. static int ccnt = 8;8 o4 }3 P. A% r: U: P# ^
  81. 5 }+ |6 U) z' @: b
  82. module_param(acnt, int, S_IRUGO);8 n; \- k4 \2 ]9 u; w$ w$ L5 \
  83. module_param(bcnt, int, S_IRUGO);
    6 Z$ l  R& W7 p+ u$ F, x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* j6 ]% m# l! o: _1 t; |3 n

% B% ~4 m8 ^9 |- Q' z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e3 D0 }: x. E3 G) P* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 Y1 h/ I7 s  n6 y3 J/ d2 h8 o6 M9 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) U3 Q7 {$ t) a
: l: R* r1 M  o: V, @6 J
9 k. s( G. v+ p' X4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 03:21 , Processed in 0.047952 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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