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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 V' z$ P8 m' D1 g$ l" L
  1. [code]EDMA sample test application
    1 @) N+ F; o% n2 w3 N* I5 ]
  2. /*
    & a+ ]' M: s) I6 P# p8 g% c
  3. * edma_test.c( d3 _; ?9 E6 c% E, Q
  4. *
    % Y: j8 ]/ d+ D
  5. * brief  EDMA3 Test Application% J% u8 ?# g& X- P% E6 z5 _
  6. *1 C- K( S7 c% ]3 \4 q3 V6 s' T5 u
  7. *   This file contains EDMA3 Test code.9 N) J1 L! {3 [- U+ I; I
  8. *
    6 m1 k, n: o0 l: W/ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; e0 ~& d2 [; u! y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 S* n( e# d7 T7 v
  11. *         TO CHANGE.4 p" V5 \0 L" R, X
  12. *$ v4 M( |- ~2 k4 e8 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ v, h+ f- L' W$ S
  14. ** y4 u0 u) G$ M( w9 Q
  15. * This program is free software; you can redistribute it and/or! t# _5 F0 B& A/ H: S
  16. * modify it under the terms of the GNU General Public License as9 s9 f$ V; R0 j- l6 _
  17. * published by the Free Software Foundation version 2.  O! r: f, @% h0 e; T( ?6 a4 o
  18. */ k, t- X( y* \- M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 x; I  X% t* I/ F# d; V* q
  20. * kind, whether express or implied; without even the implied warranty
    ; E: ?1 H. I1 C. ?- {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & V; I- ^7 @& f- o, ~
  22. * GNU General Public License for more details.
    6 ^* g$ K( x* N) M
  23. */
    : ?+ H4 W4 Z1 a% `4 }3 e4 D+ r4 Y
  24. 8 ^* B- \9 X/ k$ ?* w, M, t
  25. #include <linux/module.h>, P2 ]: J) |1 B( \1 k
  26. #include <linux/init.h>% q4 ~, }* G+ s- ^" h( G
  27. #include <linux/errno.h># m3 w+ i, {' k. i. F( A, }5 Q, U' i) {
  28. #include <linux/types.h>
    / J) O8 n- Q# {* v, C; R# P2 Q& V
  29. #include <linux/interrupt.h>
    9 `0 a. t" U5 R$ [# a# f% `# z
  30. #include <asm/io.h>
    6 r6 M5 e' i* g" k) X3 X
  31. #include <linux/moduleparam.h>, J8 O0 x' F# h+ F) W$ q
  32. #include <linux/sysctl.h>
    9 f# T- x! M; y! ]& Y/ n
  33. #include <linux/mm.h>
    7 a9 @* K5 X: U; [
  34. #include <linux/dma-mapping.h>
    4 K0 V6 h& t! X1 a! F. C
  35. 5 b0 W1 A) K3 k
  36. #include <mach/memory.h>
    * X3 Q  L* a( E- x
  37. #include <mach/hardware.h>
    ; t" E1 |/ h6 b% s# ]9 B% L6 S  J3 R. S
  38. #include <mach/irqs.h>' }  g5 V. ^+ ^) h: Q" p5 Y
  39. #include <asm/hardware/edma.h>! n; A  t+ {4 H
  40. 6 h4 d2 d/ n$ ]4 p% \, p( c
  41. #undef EDMA3_DEBUG
    % ^; \6 @4 R. }$ v% F* k
  42. /*#define EDMA3_DEBUG*/% }# v/ I6 ]# Z* u: P8 O+ R
  43. . d6 B6 T" M, ]% r& C3 I
  44. #ifdef EDMA3_DEBUG
    % v7 g6 W/ ^6 J5 f& r5 t3 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F! z) e$ U( |; E$ \7 k6 i7 l+ K9 G1 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 P  t  c" a4 q9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 S) [2 ~- C) t3 {, x. x- A0 n
  48. #else
    # B4 N! I1 `4 F% a; S* l
  49. #define DMA_PRINTK( x... )
    / z) K& c+ `& w$ C! j6 p
  50. #define DMA_FN_IN' G0 z* x; [+ \& w! R+ @* g
  51. #define DMA_FN_OUT
      Q% C, F6 O8 t* j
  52. #endif/ t' S: f1 N+ Y- y9 T5 P
  53. ; C" P1 P6 i9 d: F; }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 _! m8 E" x" E1 v" v
  55. #define STATIC_SHIFT                3' i  }& \" d9 E: |& p- u6 {
  56. #define TCINTEN_SHIFT               20$ P; t% C1 V$ w  A
  57. #define ITCINTEN_SHIFT              21
    : ]" m% K/ S+ c0 \; w" G+ g7 `
  58. #define TCCHEN_SHIFT                22
    ) k$ R$ r2 s8 `" j1 j, `5 ^
  59. #define ITCCHEN_SHIFT               23' q' d5 ]/ g/ {2 \$ c. C/ g
  60. 7 Y4 q$ k* _5 b/ Z
  61. static volatile int irqraised1 = 0;, n4 j4 S" f, u4 o
  62. static volatile int irqraised2 = 0;# Q$ F; M$ Q5 z8 T# f) m2 a! B
  63. . @* e" ?" ~/ _4 @1 ], |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I0 j8 @; k- E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; y) f! t) Z& t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " A2 e1 l! M# B8 X
  67. 3 l9 e/ i$ J. B" ~+ a4 G. {
  68. dma_addr_t dmaphyssrc1 = 0;
    5 O9 g# w0 L. q2 g: N0 P
  69. dma_addr_t dmaphyssrc2 = 0;& K4 j7 P( F) w: I  K& j
  70. dma_addr_t dmaphysdest1 = 0;
    9 ?  |* u" P& p
  71. dma_addr_t dmaphysdest2 = 0;
    + }1 Z& T: E- f' o
  72. / r5 p0 N  X/ H( F$ M1 q+ R3 @
  73. char *dmabufsrc1 = NULL;9 l* |5 w& h, e* N
  74. char *dmabufsrc2 = NULL;" D. Y& F' N5 z, v- v" y: H1 F9 P
  75. char *dmabufdest1 = NULL;
    0 e: g/ q' `" F4 L0 Y
  76. char *dmabufdest2 = NULL;
      @, k( K: i6 j% Z4 O6 N$ ^
  77. , e7 w$ l) C( @% P6 v. P
  78. static int acnt = 512;
      M9 S: G% T9 ]4 _0 Q! F8 E) U5 v
  79. static int bcnt = 8;
    . D3 ^8 V0 C- h, |2 o2 r2 J
  80. static int ccnt = 8;
    ! _2 q# d/ i. U5 T; b% [
  81. 0 L0 R3 P6 N/ p3 N: m2 e  Y5 ?0 f
  82. module_param(acnt, int, S_IRUGO);$ f$ d5 N# m$ D% q8 s) C) s
  83. module_param(bcnt, int, S_IRUGO);
    ' @4 M% O7 P# f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ c- U+ K! ~! _
8 U, ^0 W9 ~7 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 {- u& v$ O. X4 Y# ^9 M: }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# I1 w0 _- X+ J0 [/ l% l1 j) X9 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, j* r) R4 o, J8 j& _2 I4 m: ^

: E6 `) C' [% S& t8 b  U1 Y) O( J8 \% s" X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-11 04:07 , Processed in 0.050732 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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