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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ \/ f& v2 v# _; `5 V9 Q; _
  1. [code]EDMA sample test application
    1 J0 n) |2 T/ U+ B( H3 }6 b
  2. /*
    5 s  U8 K, t* g0 U' H5 X( `
  3. * edma_test.c
    ) D5 n3 w- Z7 l' E1 b/ T; g
  4. *- V* ]" f. k4 H" m) F
  5. * brief  EDMA3 Test Application
    6 Q! q6 o8 S# T+ L5 r0 L
  6. *# h3 S% C; v9 ]1 w" j2 |, ?
  7. *   This file contains EDMA3 Test code.6 Q1 f! D) Z# [' z& y4 Y/ x% j
  8. *
    ' H; O6 n+ n1 m& G6 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* l  I# X& i0 L3 i$ R: e; Y3 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. t) A& Z$ z# a! G) [
  11. *         TO CHANGE.. Q8 Q' L% W( a& M/ d  R
  12. *
    + p. s! e6 U3 t$ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Y2 b# j" b: G
  14. */ W: v& x4 b2 s& k, @; G# Z8 m
  15. * This program is free software; you can redistribute it and/or
    3 |6 K: X: n3 y& ]; h
  16. * modify it under the terms of the GNU General Public License as9 y1 i" R* B3 _( |% y! c
  17. * published by the Free Software Foundation version 2.4 ^, j3 Q0 ?- U, ~3 C4 `: o# h
  18. ** ^1 J: U8 t+ l" |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P* V, Q/ ?& ?+ q6 f
  20. * kind, whether express or implied; without even the implied warranty4 f1 J% C+ ?$ c# z! U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % Q! `: b4 x2 c: P8 A
  22. * GNU General Public License for more details.
    / @: h/ K0 F  }" |7 o0 T
  23. */' a5 \% c( O+ _+ a0 N7 u2 E) f  v. J& g
  24. ' L0 c6 I  ^) L/ j$ Z5 X# d. d
  25. #include <linux/module.h>
    ( S' G  Y/ s8 J7 [" I+ v% s/ K
  26. #include <linux/init.h>( t. ?5 q" V- s% O7 }: }: d  l# G: g( C
  27. #include <linux/errno.h>  R* `; {  B' n2 P3 C
  28. #include <linux/types.h>6 N" C/ f5 ]1 E3 d; M
  29. #include <linux/interrupt.h>  q+ |* p4 |( ~: \) Z' K
  30. #include <asm/io.h>! ^% D$ K& t2 }# l, x/ D8 ^
  31. #include <linux/moduleparam.h>* G" w+ z0 ~# }4 _. A" Q
  32. #include <linux/sysctl.h>4 |0 H+ l9 j/ [
  33. #include <linux/mm.h>, O/ {0 T! x7 J# W  ~' q
  34. #include <linux/dma-mapping.h>6 X" h2 r; z- A/ k0 u$ _' N- d1 A
  35. 7 D" i$ }7 _0 u4 ~* p
  36. #include <mach/memory.h># q5 g- d9 v. e
  37. #include <mach/hardware.h>5 e% h0 M! _8 T  r
  38. #include <mach/irqs.h>7 @) u- j) Q5 o/ A+ o+ A. r( q
  39. #include <asm/hardware/edma.h>
    1 N9 X' v# o0 B. O( U/ q& N6 t
  40. & y+ O- p/ B9 H9 i$ j' W
  41. #undef EDMA3_DEBUG
    # m# o. _* m6 e( \
  42. /*#define EDMA3_DEBUG*/# {8 Y$ {* r3 I+ d

  43. 5 J/ o8 [3 G2 m- H
  44. #ifdef EDMA3_DEBUG* g" ?7 x  |8 F0 a: k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L/ {' Y6 {( ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  w0 [: }! A0 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * h. v' a: Z# j. U% D5 _
  48. #else
    6 w# A* q( d5 k3 z
  49. #define DMA_PRINTK( x... )( n2 A# o6 H  S* [4 |
  50. #define DMA_FN_IN" B# q) }# Q; A
  51. #define DMA_FN_OUT
    ! i8 {- W9 j" t2 S
  52. #endif
    " g. n! a- C( {  y8 D) _
  53. * o# \( O$ n% t+ S6 \/ ?; g. u4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 J5 P  B' I( J1 Z, z% [2 k6 A
  55. #define STATIC_SHIFT                3
    4 h6 y1 ]' h  y3 ~" V
  56. #define TCINTEN_SHIFT               20
    7 A2 w. h6 j8 Q* x8 G$ _; M/ Y
  57. #define ITCINTEN_SHIFT              21
    ( G1 R3 w7 `1 z  z* H+ ^
  58. #define TCCHEN_SHIFT                222 Z  b' o. ?6 v% |& f7 M
  59. #define ITCCHEN_SHIFT               23- q% u6 F/ J, |4 a# o% r+ v
  60. 5 N- N5 Y2 e* J8 I) J
  61. static volatile int irqraised1 = 0;" t  A; Q1 x& D, r: A
  62. static volatile int irqraised2 = 0;' @2 S: H4 F* c

  63. + J) w2 k0 T+ h* G' C3 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% x4 S7 \2 r0 }" w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 |$ B4 s# ~( B0 g3 ~, x9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . m# d  m+ ?! G5 l

  67. % T5 q5 q7 I9 h
  68. dma_addr_t dmaphyssrc1 = 0;
    $ Q0 V& r! ^7 ?/ g
  69. dma_addr_t dmaphyssrc2 = 0;! y' _5 O9 _& o; g# i
  70. dma_addr_t dmaphysdest1 = 0;
    - o" Q& [; w6 a" V
  71. dma_addr_t dmaphysdest2 = 0;8 m! s  r: @$ f- O7 x

  72. 3 t: x3 I! }3 C  i- X  Q
  73. char *dmabufsrc1 = NULL;3 q2 _6 O) y5 f1 C6 F9 V
  74. char *dmabufsrc2 = NULL;
    " v. N' v5 N8 {( `
  75. char *dmabufdest1 = NULL;) X) H0 P4 o; n4 I
  76. char *dmabufdest2 = NULL;
    - |' W8 Q; L$ v# P, o( Z7 C) k
  77. + E! q  ~1 Q( ^0 R5 Y6 \. k# }5 h2 z
  78. static int acnt = 512;  z7 Y& A4 w/ ^' ?
  79. static int bcnt = 8;" \7 c3 h! b# t) X: Y
  80. static int ccnt = 8;% x# [6 e: i4 O" q5 |! \2 H
  81. * g1 K' t9 b& k7 A1 O
  82. module_param(acnt, int, S_IRUGO);; H3 r! _: f, }& e5 f5 Y) w
  83. module_param(bcnt, int, S_IRUGO);. |) E  T, `" l1 i/ U7 z" J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 |7 l. N, b. @7 m* X& Q) n, }
" S9 p5 S7 W; d( w; p0 ^- U3 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 a2 J0 ]+ f# t. k/ u& yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; v# m8 H$ y  a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& A& u9 B* {' c+ F- L' D

4 r* X0 D7 B6 J. I% x+ Z  z" R/ O1 T7 C! K# c: o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-20 12:21 , Processed in 0.057104 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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