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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# q5 g' t+ O: r$ B" x+ M
  1. [code]EDMA sample test application5 o2 p/ a- ?; T" A% l5 t4 @# u% w
  2. /*$ p/ x# Y# z0 i* R; O8 a! F% x0 E
  3. * edma_test.c6 j8 w" Y) Z  T3 w
  4. *" Q' e, C* b5 k  [
  5. * brief  EDMA3 Test Application
    " H# v- M+ a4 p& X
  6. *; M' s7 c. H$ N; ]# x1 y* V
  7. *   This file contains EDMA3 Test code.) K+ v2 n: ?5 c5 O+ J" }" Z3 J
  8. *
    9 t2 v9 g" ]" J, C! `6 K7 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D- Q  s! i$ F, r: Y6 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 k4 p1 S+ \# y' m
  11. *         TO CHANGE.
      R! f0 t' C) B, @# a0 P( j' c( a
  12. *
    - S$ M* {- }3 {# J) u9 {* m8 e) ^1 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  T3 [* I$ T# a8 F; S4 e
  14. *
    1 \6 b3 k+ ~8 \# b1 `% @: Y
  15. * This program is free software; you can redistribute it and/or5 Q; ~0 V2 _* ^% ?7 `' W3 w
  16. * modify it under the terms of the GNU General Public License as6 k8 t& H9 T* l5 Z. B8 T
  17. * published by the Free Software Foundation version 2.( D- z3 x' d- l5 Q4 `7 U0 l
  18. *
    + F; N4 w0 l0 }+ X% H+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! C& ^: ?9 _8 x; M0 k
  20. * kind, whether express or implied; without even the implied warranty
    3 x" j- I" Z2 F. ?/ U1 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / h8 L7 Q6 b5 Y+ O
  22. * GNU General Public License for more details.: a0 g) _& h; b1 g2 w7 F7 P7 \% R
  23. */9 ]/ B$ p9 D/ n# w
  24. 2 _, H; X4 {3 J& L3 J
  25. #include <linux/module.h>
    , W" s$ h" `. u1 m! V1 B0 _, w9 Z
  26. #include <linux/init.h>
    / c/ [& m6 F# _2 t
  27. #include <linux/errno.h>9 B% ~' j- z5 _1 P4 C6 g( ]
  28. #include <linux/types.h>* E: E7 e" o8 d) g! D, q9 W7 [
  29. #include <linux/interrupt.h>
    ' z; {8 R- y" [7 ^7 y) L+ f
  30. #include <asm/io.h>
    4 ^$ S: c/ h0 `! v
  31. #include <linux/moduleparam.h>0 w! i. b5 O( j6 W
  32. #include <linux/sysctl.h>
    5 ]. ~7 X( K/ K5 }7 l, M2 R% k
  33. #include <linux/mm.h>8 _2 ^6 A. v- |( ^9 Q( r
  34. #include <linux/dma-mapping.h>
    ( ?9 N* V6 d9 l% z1 I  \
  35. 8 w$ X; \+ }: P) m, E: C5 O
  36. #include <mach/memory.h>% o& ^2 r% ]" F& i, X+ G
  37. #include <mach/hardware.h>
    8 ~4 x: ?% s" O4 ]
  38. #include <mach/irqs.h>
    . N+ u3 o* ?% m
  39. #include <asm/hardware/edma.h>6 O. I2 F5 H+ V( x% g
  40. 2 H6 n; [6 @0 q  L& q- \' _
  41. #undef EDMA3_DEBUG6 A- b  u  @/ C  u
  42. /*#define EDMA3_DEBUG*/+ u4 A$ m) v2 ], C$ }, H
  43. ) p! g& p. t* H: y  ~" _! F
  44. #ifdef EDMA3_DEBUG
    , }& x- E: y4 ~# [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 S& m; \3 L7 _& M& Z/ {* g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 W* j5 q+ l! v9 ^' G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 c3 P7 o9 j; m% q
  48. #else3 [0 H7 f& o$ W' L5 Q$ [
  49. #define DMA_PRINTK( x... )
    1 r5 K- \( @( u4 ~9 {. m$ H
  50. #define DMA_FN_IN
    + x. |$ v7 i6 r
  51. #define DMA_FN_OUT' W: ~* n1 e, x/ C
  52. #endif
    8 {' k: B9 H& ~& ]9 Z
  53. , I! o& M8 w$ ^0 t! V4 F5 h' S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ C! I. N( |0 e
  55. #define STATIC_SHIFT                3. c# X  M& A$ D3 d, f
  56. #define TCINTEN_SHIFT               201 n! p4 a2 x$ p4 ]. C9 ^* o0 V
  57. #define ITCINTEN_SHIFT              21
    . B5 P$ o; K" b9 h2 q' Y1 E7 s. s! J
  58. #define TCCHEN_SHIFT                22
    ! |4 l5 X/ h+ u/ y& `2 r3 U
  59. #define ITCCHEN_SHIFT               23
    2 W$ ^0 X; S. |0 h) D& j

  60. , N' y2 ?+ V8 x
  61. static volatile int irqraised1 = 0;
    % c5 l1 x' u5 h% F) B
  62. static volatile int irqraised2 = 0;
    5 p+ B9 d( G9 z: i

  63. 3 P/ G; d7 G/ F$ H+ h  c4 Y. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 y8 Z( P3 b- E. v* ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / M7 [/ v5 p- j8 m" o0 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 w# O; `$ x# a& @2 c) R
  67. 9 _. G+ s! D( b# E9 r7 y) N
  68. dma_addr_t dmaphyssrc1 = 0;
    ' _, l5 s* i, _3 s! C+ e$ w" c
  69. dma_addr_t dmaphyssrc2 = 0;3 n1 Z+ p0 f) |! g; h+ R) ?
  70. dma_addr_t dmaphysdest1 = 0;% I- u1 ]/ o, t0 z! m: k
  71. dma_addr_t dmaphysdest2 = 0;  `! P3 Z/ u8 R9 ~3 L* S
  72. 2 ~6 @7 |7 A1 g9 j
  73. char *dmabufsrc1 = NULL;
    : Z9 b9 h. U; p  k
  74. char *dmabufsrc2 = NULL;
    1 I; U: ~" F8 d( Q2 c8 y
  75. char *dmabufdest1 = NULL;
    # r9 g6 J" K* G& t
  76. char *dmabufdest2 = NULL;
    $ |0 W2 b8 s0 b3 O' \" f" F
  77. 9 `1 ^! U" Z7 t" r+ |1 H
  78. static int acnt = 512;% u+ S. Q- }2 _
  79. static int bcnt = 8;2 Y* [. f: x# [  z! S. l# V$ L3 E  ]
  80. static int ccnt = 8;
    / g+ c9 j- D' J2 O  F- j+ w5 o, c

  81. $ U9 o: \4 B% ^# P( x5 k. ^6 @% Z4 P% d
  82. module_param(acnt, int, S_IRUGO);" P3 J6 h. r+ q* N7 o: O/ Y9 `
  83. module_param(bcnt, int, S_IRUGO);7 _1 B3 R; A, I* d0 o0 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 q# i, @3 z* G; ^/ `; o7 S+ ?; d
4 N; g) I/ {/ {- p$ _) N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]# j9 A3 ~( v4 K( [% ^5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o4 `2 W# {  y( U5 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ I& u2 N2 ?. i0 }! s  a1 D& ~" M+ n
( d  a# G9 }6 m0 }
4 [6 t% W0 W' @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-6 09:36 , Processed in 0.042872 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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