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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; L2 }3 o% D0 {3 S7 T6 ?# k9 F7 {
  1. [code]EDMA sample test application3 A% b" S& e0 C& `
  2. /*
    5 a" m( Y2 @" o" ^1 i5 w
  3. * edma_test.c
    3 }; l. U7 B1 ^! I9 C& `  P( _
  4. *% W, _$ d4 c" D4 j( h( h7 C
  5. * brief  EDMA3 Test Application
    8 B: R4 j0 j( g1 t. W
  6. *
    9 o6 I6 Q. |) a8 B  N4 ]
  7. *   This file contains EDMA3 Test code.) ]( P4 S  P6 _1 ]# V9 O
  8. *. d% Q* {6 O! P1 s8 Z1 p/ [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 u3 A  D5 o5 C7 `' c5 {" O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: S" h6 v5 i9 N! T8 F! Q
  11. *         TO CHANGE.# V; u. h- d/ J$ ^( r# p
  12. *
    0 _+ a* e/ {  |  _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 Q& z# p/ `$ p& _. |4 K
  14. *1 N! s) K8 Q$ u, T* l4 @
  15. * This program is free software; you can redistribute it and/or* I* S3 X! A3 a7 }# Q3 {; i
  16. * modify it under the terms of the GNU General Public License as
    8 c6 e2 u2 M$ ^) M
  17. * published by the Free Software Foundation version 2.
    $ v5 b* o* M! b9 @6 r5 K
  18. *9 F3 B/ Q$ e' y8 H/ m# G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 S2 _" G  @  k9 C$ s2 B! _
  20. * kind, whether express or implied; without even the implied warranty, A2 C/ @: O$ b9 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % [' u+ d# T  d6 d
  22. * GNU General Public License for more details.7 ^* |4 s7 _# g$ y* y: i
  23. */
    $ z$ }* @+ c: ?% e/ Y; E1 Q

  24. & `; W2 L" A; ]+ e$ P5 T
  25. #include <linux/module.h>$ [% h! D. R3 {- t: f; s
  26. #include <linux/init.h>; T: G2 Y0 d3 D+ o, ^/ V
  27. #include <linux/errno.h>$ b/ _& ~" L! g9 ]8 G
  28. #include <linux/types.h>8 @6 n2 c1 W, ?
  29. #include <linux/interrupt.h>
    $ M5 r; W/ _/ A$ q& c
  30. #include <asm/io.h>
    ; `6 I5 E' o* u5 C
  31. #include <linux/moduleparam.h># P1 D: U2 V; f* I. R
  32. #include <linux/sysctl.h>/ [, H4 I3 a8 w/ @% Q9 @% X& z1 h
  33. #include <linux/mm.h>
    8 h5 U/ a8 W, ~. C. S% ]1 w1 H
  34. #include <linux/dma-mapping.h>5 B4 |8 p) w: t  S
  35. ! G0 w& p* R2 r% f! k1 @
  36. #include <mach/memory.h>* Z2 O% ?/ w6 g8 {7 W3 r
  37. #include <mach/hardware.h>6 e1 y7 F& |( d5 P& E/ u/ Q6 P$ K
  38. #include <mach/irqs.h>
    ) |5 E- A- P  C0 S  M3 S9 U( o- a* ?
  39. #include <asm/hardware/edma.h>. ?1 x# G$ Q" s* [
  40. $ u" i0 Z) x  X6 g
  41. #undef EDMA3_DEBUG
    . h: D9 D5 i2 N# {
  42. /*#define EDMA3_DEBUG*/
    # ~7 _( y1 q% b5 n  B+ x* H8 E
  43. " z9 v) e" m9 E7 W' A" Z1 l+ b
  44. #ifdef EDMA3_DEBUG
    * m' q# K0 r! p/ G8 D7 D4 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ H; Y6 Z' D* o: V" g% }! s5 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * o' n9 i7 @6 ^! L+ V3 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 }7 O- p; H# v6 G5 e; d/ R& P
  48. #else
    0 P( L- E. `5 \: E% l7 }% q9 |  ^
  49. #define DMA_PRINTK( x... )! `( o% m7 O" k
  50. #define DMA_FN_IN
    ' Q) |4 {! C  w  F% g, t. q8 @
  51. #define DMA_FN_OUT9 E$ R0 X3 ^# j6 P6 ?
  52. #endif) \/ C8 [6 ~; C' ^! w
  53. 8 H% R& T+ |( o* [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - \. A0 |4 G8 r: x# r
  55. #define STATIC_SHIFT                3
      z8 b9 u. T$ {* p2 g) Q
  56. #define TCINTEN_SHIFT               20" t9 ]; @# y8 W8 a
  57. #define ITCINTEN_SHIFT              211 H7 [5 Z! D4 [, s" P4 B
  58. #define TCCHEN_SHIFT                22
    2 f3 ?& L8 `! X' e
  59. #define ITCCHEN_SHIFT               23
    , r% ~2 }3 ?" @+ H7 V4 c0 k8 ?5 S6 ^/ F3 A
  60. 1 r. A9 ~9 \! z' d- j
  61. static volatile int irqraised1 = 0;
    8 ~/ c4 K* {  O% d! w
  62. static volatile int irqraised2 = 0;
    , q2 H9 i3 ?9 S
  63. " |0 P7 N& z9 {9 h4 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?8 h5 h; I! b- b- K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N; k+ ^" g9 f& @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N/ N* q( o) ^7 O8 L# a+ M) w3 i  W

  67. & N6 L" d* M; d7 r/ G3 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    , a+ B4 S/ l! I. Z
  69. dma_addr_t dmaphyssrc2 = 0;
    , _# V% l0 H/ R8 f: p
  70. dma_addr_t dmaphysdest1 = 0;
    & `* ?/ @0 D6 U( }
  71. dma_addr_t dmaphysdest2 = 0;
    + `6 K$ M6 d. f! x+ n+ S
  72. # M1 v- ~" f8 p6 G
  73. char *dmabufsrc1 = NULL;$ G9 e3 U- [- ^" P) x9 b" w
  74. char *dmabufsrc2 = NULL;7 |6 I+ F% n' s2 f  E3 m
  75. char *dmabufdest1 = NULL;
    8 R5 G5 D+ U, h
  76. char *dmabufdest2 = NULL;
    + Y9 w! L1 }/ a2 a$ d$ [( ^' T

  77. 3 G; d. H! c9 b2 y/ T7 l
  78. static int acnt = 512;
    , d/ H' L1 [$ ?/ [  D' ~) H4 `. L
  79. static int bcnt = 8;
    / p3 G& S7 [1 T- T( a$ Q
  80. static int ccnt = 8;
    , y* j, w6 S  |: Q, g) C
  81. ' L- n" B9 z+ G; u9 z
  82. module_param(acnt, int, S_IRUGO);5 u3 r$ ^( U2 L, V' s
  83. module_param(bcnt, int, S_IRUGO);% ?; j3 U5 M7 ]  s& ]& t; `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" p9 R% c& R% d+ ^* X' L% k& d6 V$ M9 E7 V" {9 L& ?3 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 |3 r* P8 X$ P- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 c$ d8 Z% \+ r/ C! g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c7 c. l) b' S/ o+ \# D2 s' |! l: h( A2 u' y1 N

; R. k( A( ^* Q) r6 |2 a7 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-10 09:21 , Processed in 0.039388 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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