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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 `, }. J% Q$ k, n! A
  1. [code]EDMA sample test application
    6 e* B; w/ B7 f" ?8 d) y5 |
  2. /*1 T5 `8 \, n1 ^" s0 D" f% z3 B
  3. * edma_test.c
    2 z* U% O) k3 E2 X$ e/ J5 e
  4. *# q8 j4 _3 B$ K( {9 ~  @* \0 T( y7 T
  5. * brief  EDMA3 Test Application
    , w6 P% z) [) [4 H: T7 w, A$ `
  6. *
    4 `6 ~" d) s' N2 A1 T  U# d
  7. *   This file contains EDMA3 Test code.4 c) u  l( l% F8 C& D
  8. */ f2 x2 o  S; b; h( @; v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 U& E2 n6 G( ?$ \: d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 n9 k$ s; {, O
  11. *         TO CHANGE.- _  E& v; H1 i. j  l0 t- m) y3 T) U
  12. *- K0 ?' |( g8 t* s+ h$ {. A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: w3 O1 i9 l( T2 M. J8 C% a3 r
  14. *
    ; Y, q! M) s' U' K: x
  15. * This program is free software; you can redistribute it and/or8 f: u9 A: ]3 j  p9 |
  16. * modify it under the terms of the GNU General Public License as+ F7 F. \- ^7 D: v; a. n
  17. * published by the Free Software Foundation version 2.( B: S5 J# y3 S" r& E) P
  18. *3 q7 P5 g; p2 E, y% P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 E5 L4 l* S6 b* I3 Y& a! x
  20. * kind, whether express or implied; without even the implied warranty! Y+ f# ]4 X* r' m3 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ k7 ~$ p$ k* }6 ~) t7 |
  22. * GNU General Public License for more details.3 h( M& q& `; B
  23. */
    7 W: n& |8 t3 `( a( K1 y" J- v6 N

  24. 1 ~. r4 a- y0 L& ?1 \, G5 ~
  25. #include <linux/module.h>
    6 L) N* e6 P: o/ [& l% s
  26. #include <linux/init.h>0 N$ o" P' r+ Z$ w' a% [* d
  27. #include <linux/errno.h>
    ; A% |  [4 j. c' @* ?, k: j
  28. #include <linux/types.h>7 O8 [. f% L; O2 l% U" j1 ]6 H
  29. #include <linux/interrupt.h>
    + v- c5 j: d( a- O4 l" n
  30. #include <asm/io.h>  A9 K* R: s" p
  31. #include <linux/moduleparam.h>$ c- f8 u7 \$ S+ Z! X
  32. #include <linux/sysctl.h>, T! Q' H* i6 E, F! p4 M
  33. #include <linux/mm.h>
    + G3 N/ w! g" P& u# p
  34. #include <linux/dma-mapping.h>0 N4 b0 K  e4 W
  35. ! ~8 F4 W- i+ R; G
  36. #include <mach/memory.h>
    ! A4 @& \7 Q" J" K  B# s5 v  ~
  37. #include <mach/hardware.h>
    + {8 q) h7 k3 u$ {
  38. #include <mach/irqs.h>
    3 }5 z* j" e3 e+ {
  39. #include <asm/hardware/edma.h>
    - z5 t9 }0 m, d- A1 N: B7 A

  40. 2 ?3 T7 S6 U/ R& ]5 w2 o/ T
  41. #undef EDMA3_DEBUG
    - ~2 r6 o9 Q' l
  42. /*#define EDMA3_DEBUG*/& z4 `9 {* f) `# b/ `

  43. 7 @" ?2 r" F% `2 q/ i
  44. #ifdef EDMA3_DEBUG0 u+ k+ s9 o7 u  _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ r. N2 B( q7 A$ \; I: N6 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 b4 K5 A3 C6 d; D2 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 J1 f& `8 e) L  s
  48. #else
    3 K. _/ i7 Z0 t. A5 g6 S, U
  49. #define DMA_PRINTK( x... )" Z* y3 Z. {% j4 |6 _# ]1 t" e
  50. #define DMA_FN_IN7 s4 h( m6 V& `0 A" {3 R7 p1 _- k
  51. #define DMA_FN_OUT9 j3 f( s8 o4 _) b
  52. #endif5 I1 t4 Y% a. u0 K$ ~
  53. ; j$ p: B; @1 |* Y' ?8 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* X$ O- ~. S& ~9 s, W$ b: u
  55. #define STATIC_SHIFT                3/ d2 C' R; M( y3 v5 m. x, L
  56. #define TCINTEN_SHIFT               20
    ' g4 s! P8 p; A& V  q
  57. #define ITCINTEN_SHIFT              21
    ' k* R, C0 f, c8 m7 s" H; ~* R
  58. #define TCCHEN_SHIFT                226 J2 j; `$ D; m4 F  B
  59. #define ITCCHEN_SHIFT               233 `, ~7 v0 G* y% j( o  e

  60. ) A. L6 w7 A2 B0 H2 z2 {# ~- x; P
  61. static volatile int irqraised1 = 0;& N9 F4 m9 m( t. w7 P  {/ ^& I
  62. static volatile int irqraised2 = 0;
    # K7 H& ?) e0 t8 Q! t+ t  B: T9 x
  63. # ^! k2 X5 J; o* R, y2 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 w7 M) U+ ^* e) D, x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - \. g* J# F( x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 h/ \; |" c, V( F6 p9 F
  67. ( d2 V! e; t; E4 v! H
  68. dma_addr_t dmaphyssrc1 = 0;
    % d  n' c( a6 j( E
  69. dma_addr_t dmaphyssrc2 = 0;) L) x: _+ m* m9 T* a' P
  70. dma_addr_t dmaphysdest1 = 0;8 }9 \! }$ n, u0 C2 v
  71. dma_addr_t dmaphysdest2 = 0;
    6 ~- J& r4 R! ]
  72. ) m, M0 o) S1 `! z% y% k
  73. char *dmabufsrc1 = NULL;, k/ c/ E' ?7 a  r' d
  74. char *dmabufsrc2 = NULL;3 W0 \' x: L2 r- ], A8 m- I' E9 i
  75. char *dmabufdest1 = NULL;6 S; p) W! ]2 V6 h5 q
  76. char *dmabufdest2 = NULL;* z* \8 W# A, t  U5 ]
  77. ) }+ f( J& h9 }! g: F
  78. static int acnt = 512;- o" m, |$ ?! z) s6 N  w
  79. static int bcnt = 8;
    2 t& q6 B4 F, o  E
  80. static int ccnt = 8;
      c% ~/ m1 s( \- w  ^; R
  81. 2 d, ~' n: \/ [0 W4 D8 o% n9 c
  82. module_param(acnt, int, S_IRUGO);
    " @4 V" {, X! e9 x- i$ W5 }5 V  P6 l
  83. module_param(bcnt, int, S_IRUGO);/ i6 Q8 g9 }  _) j3 E4 ]! D5 s% b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 Z" t! b) u, y- S+ R
! V: @/ B3 C7 k6 M! A6 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. W" {- Z1 ~8 o; X% v3 I
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 e- K, K! [8 v+ D) {2 p& Y0 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 i9 k) u# P6 Q. J- t
9 g1 M& I# s) ]! C/ {
1 ^3 ?( W% o( v% X! t, ^* Y( l, \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-3 07:17 , Processed in 0.038298 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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