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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* V2 F, T- t% Z# L& E# @8 c- x7 F
  1. [code]EDMA sample test application
    ; A) T* o: [1 K7 _% C! I* _5 u
  2. /*
    - ?, N7 ^# S6 H  Q6 Z- w
  3. * edma_test.c
    8 P' ^7 ~; s* m- t/ m) m
  4. */ r* i: s+ \7 P4 J! m- D
  5. * brief  EDMA3 Test Application
    8 _$ m7 y$ {, x5 t. E
  6. *
    - |+ l. ]% B) y2 F
  7. *   This file contains EDMA3 Test code.
    " n$ R9 I' G1 J3 n2 {- J$ \
  8. *9 H: d  L7 U" m+ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 R% [( j+ i2 C* j3 Q1 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 P) U9 U3 U6 R' G& e
  11. *         TO CHANGE.
    9 a9 Q5 C! p, ]/ v8 W
  12. *0 {% Q* U0 n5 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 {, t# K! r' z9 d& x, h$ g
  14. *3 I5 f0 H5 m1 r, W
  15. * This program is free software; you can redistribute it and/or9 n1 y0 L2 _; i& y! \( N
  16. * modify it under the terms of the GNU General Public License as
    ( L  Y5 ^# s8 N* L& r7 }
  17. * published by the Free Software Foundation version 2.& q/ M% E0 j$ o  U' o
  18. *# g, s6 w; d7 J8 I# b: Y  U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ S9 i% A3 s* U; B/ i1 Y) D
  20. * kind, whether express or implied; without even the implied warranty
    # m7 s. l& ~! B0 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- @0 \: Y: _1 x' U4 w; E4 W5 w; Y
  22. * GNU General Public License for more details.
    " ]: ]; z* T$ L6 v1 C" L
  23. */
    * L' {% n- N9 e4 N' n3 c; C

  24. / B6 k8 ?" S1 W/ N: Q  c
  25. #include <linux/module.h>2 u6 R' U; N: L0 K9 B1 z
  26. #include <linux/init.h>
    4 w  q  Z6 k- D1 S. W
  27. #include <linux/errno.h>* h; O- [& g0 L8 x- y# v0 g
  28. #include <linux/types.h>
    / i& \$ G) i! Z4 {2 h
  29. #include <linux/interrupt.h>% N% \7 }  G, ]/ V9 E7 |
  30. #include <asm/io.h>
    # K/ j4 V: G/ ~! n+ {! R  h7 I* A1 _0 z
  31. #include <linux/moduleparam.h>
    ' X( Y1 N: ^, ~* S+ \* C
  32. #include <linux/sysctl.h>
    3 ^! b  R3 V2 j- G
  33. #include <linux/mm.h>
    6 S# ^+ h+ i% p7 W  o
  34. #include <linux/dma-mapping.h>
    # @, D, @1 N  ^3 W$ B* u3 }

  35. - w/ |+ \6 ]: f5 D
  36. #include <mach/memory.h>- G, E! ~5 q! F( z
  37. #include <mach/hardware.h>6 j% X7 j, r# \: E
  38. #include <mach/irqs.h>( @" W5 j; C; M6 O" v
  39. #include <asm/hardware/edma.h>8 X$ e; Y; p0 N! ^
  40. , F$ Z. z! I5 A' ], B% l/ ~! [7 i
  41. #undef EDMA3_DEBUG3 ^4 W- W) \' k  Q# O% P
  42. /*#define EDMA3_DEBUG*/
    8 K9 W' w; e% t0 s5 R

  43. 2 C5 o" M, Q% x+ W7 Z. k) K9 F7 ]9 T
  44. #ifdef EDMA3_DEBUG
    % x1 }; z3 K1 c, y, Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 i. g3 A' P& \: x" i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' b; Q: V7 W! G8 c. |0 k# u2 P! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , y* }4 V9 A8 {+ v/ R# j& A. T( B7 M
  48. #else
    % I% j8 E' Y' X2 i4 L
  49. #define DMA_PRINTK( x... ); [/ v" h9 [  p/ V: q2 r/ f& @
  50. #define DMA_FN_IN! g# w5 _+ Z2 B+ q
  51. #define DMA_FN_OUT  `3 S1 X8 U" _. E
  52. #endif
    8 I2 D  h6 g! u5 Q+ u" J

  53. 4 J1 [5 B: n0 a! J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ g) y# q+ J6 S- j
  55. #define STATIC_SHIFT                37 N) K3 F+ L/ m+ [6 Q# I4 B
  56. #define TCINTEN_SHIFT               20
    . F7 M" r2 O3 f# L4 s9 W0 F
  57. #define ITCINTEN_SHIFT              21. |7 J/ ^& w% S  n9 C
  58. #define TCCHEN_SHIFT                22/ Z5 @/ m5 V( _$ y1 Y4 p
  59. #define ITCCHEN_SHIFT               231 O* M/ h7 W2 B+ M
  60. % P# _$ ]& \) ]( [
  61. static volatile int irqraised1 = 0;! u1 c0 y- |- Y3 x3 M3 o- g* P
  62. static volatile int irqraised2 = 0;: N, Q! l! }% r$ ?

  63. ! a& I% P2 B0 Y" p% ^) ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# I5 f( V  E6 M7 H, t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . S5 N, _5 S7 G$ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A  M1 V+ T+ T' |! \& t* w
  67. 9 n- _& L% }5 r2 i) O6 [: m! W
  68. dma_addr_t dmaphyssrc1 = 0;! H' ^; n. p4 L( G8 o' @. e; Q
  69. dma_addr_t dmaphyssrc2 = 0;
    9 j2 [# }" Y" {7 z0 x
  70. dma_addr_t dmaphysdest1 = 0;! U- m1 Z: t: H9 `/ }% p
  71. dma_addr_t dmaphysdest2 = 0;! {& u* F0 c% Z

  72. ' |' `4 K" Z* W, H
  73. char *dmabufsrc1 = NULL;5 Z- a" r7 ?$ u7 i8 R' T) ^
  74. char *dmabufsrc2 = NULL;
    ) I, z2 \( ~" {: H2 n
  75. char *dmabufdest1 = NULL;
    ; g7 O; N( e6 K3 [4 N& H1 A' F
  76. char *dmabufdest2 = NULL;
    8 N5 k% c- ]- y2 D: e3 ^
  77. ; i7 g% S! ?1 a$ C" @. s0 K1 ^
  78. static int acnt = 512;% Z% c* h' P2 |' b8 ]8 {% m
  79. static int bcnt = 8;
      [, ~# t) U# l) R8 P
  80. static int ccnt = 8;
    / X2 T3 x! I7 h- J) ]1 z5 [' G
  81. ( `  X" I9 n! L5 ^! b( u3 p
  82. module_param(acnt, int, S_IRUGO);" \" U- }& z6 A5 U( K5 p) l
  83. module_param(bcnt, int, S_IRUGO);3 ~' ?5 y( S  P* v. Q2 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 M3 t9 ?+ `* t& m
2 c& |3 d0 ?' S) e& x8 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# W! w) v: s( O0 ^  C, U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 {" h/ h0 y% Q- `2 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o% U9 {  B+ d( e3 j4 v7 Q7 p* c  u
; h- i* S1 q5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-7 19:03 , Processed in 0.039666 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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