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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 f, f: c0 k) b" H
  1. [code]EDMA sample test application5 C! c8 B5 k% m( I1 w
  2. /*+ i/ K% q# u  |, |) r
  3. * edma_test.c
    4 I  w4 I4 x8 b# a
  4. *
    4 p. c; r5 E3 N% c- W
  5. * brief  EDMA3 Test Application
    # j8 R# d% T; o5 o4 L
  6. *
    * d* a' n, I) J; @
  7. *   This file contains EDMA3 Test code.
    8 A, n$ m4 J! p; e
  8. *
    : f2 B7 |9 W4 a+ r$ a3 ?- h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # u6 _; i; m0 a" R2 D' D% y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 R. e3 E, {4 {5 r3 a
  11. *         TO CHANGE.; b2 W2 @; T+ b$ O% T
  12. */ u& o$ }5 d/ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 O( M5 S6 l+ h
  14. *
    ' Y5 _# Q0 W! I# r
  15. * This program is free software; you can redistribute it and/or
    1 c9 _( J1 P3 s  c; {  @
  16. * modify it under the terms of the GNU General Public License as7 E: T* s* Z8 d6 M6 N: G, a
  17. * published by the Free Software Foundation version 2.0 H2 ]$ \4 D7 z) @$ Y2 o
  18. *
    5 k1 F5 a. ^/ b& A0 ]3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( z+ N$ A9 T+ I3 @1 p5 S* |' S
  20. * kind, whether express or implied; without even the implied warranty9 O8 `& P; u5 [& G3 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 Z2 E/ v/ ~% B6 d9 |
  22. * GNU General Public License for more details.3 Q9 M2 Q9 j0 a# M: w4 k6 C0 L$ _
  23. */
    0 N& o+ U  j* U6 i' a% d
  24. ) k' T) M0 d: U  P1 y0 Y
  25. #include <linux/module.h>
    # X. U. i+ r3 `6 }3 D
  26. #include <linux/init.h>; p! Y/ r# \6 j1 ?( N$ o8 o
  27. #include <linux/errno.h>
    ) c0 C8 r4 l+ k1 m, v
  28. #include <linux/types.h>) ^8 O0 M! `' y
  29. #include <linux/interrupt.h>9 F" @( y2 y. _7 {# @1 @8 Y( i
  30. #include <asm/io.h>% {5 I, N) H/ O  d( K% N0 l2 d. v
  31. #include <linux/moduleparam.h>+ R! q: x7 n) j- Q; ?1 t
  32. #include <linux/sysctl.h>0 P* S8 C9 a% k0 ^: z5 W0 P
  33. #include <linux/mm.h>
    4 |& `  m+ u3 S# g
  34. #include <linux/dma-mapping.h>
    1 y' J! c& \3 {' {

  35. # n8 A+ a2 L! z% h0 U; Q
  36. #include <mach/memory.h>$ H7 B) G6 ~1 O- Q6 q
  37. #include <mach/hardware.h>
    8 s( Z6 e! O- y( G9 n) q1 _
  38. #include <mach/irqs.h>+ X2 V( ~) ~! a- ]
  39. #include <asm/hardware/edma.h>4 |! I: i0 O. a9 z; o

  40. , s/ F. C% a9 |( n1 L+ Q
  41. #undef EDMA3_DEBUG
    7 T$ z  _# g6 H# |
  42. /*#define EDMA3_DEBUG*/
    # t3 g" a- o3 z3 n; {

  43. 1 `  w. G# ]: I  ?7 H/ h
  44. #ifdef EDMA3_DEBUG
    2 f! e( k( ~( V  g. I2 V3 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 {) g$ O( o: W9 F$ _8 \' T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 z: y& ~9 t! s2 i: k, {. `# A5 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % G# V; M5 K4 p9 y5 K
  48. #else
    ' I* s7 V7 G( k- t* Q, K( x  j* H. V
  49. #define DMA_PRINTK( x... )7 x- D9 Q' d) j, z  j
  50. #define DMA_FN_IN, v* ~0 k8 h$ e5 q" Q9 l) w: ?
  51. #define DMA_FN_OUT7 Q0 y  \9 ?* E% Y) Y
  52. #endif
    - ?. J, K% w1 o/ h: D! n: \# ]0 c0 S
  53. + r' E. M3 ?$ v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  v) X& k4 h, F! Y2 J0 C
  55. #define STATIC_SHIFT                3
    & E& Y7 h7 ~$ e& W) B; A
  56. #define TCINTEN_SHIFT               20
    : N  B% s5 o$ @  H- O
  57. #define ITCINTEN_SHIFT              21# w7 ]3 _" C. _1 ]* X
  58. #define TCCHEN_SHIFT                22
    ! O( r( T+ R* F# i  a3 j
  59. #define ITCCHEN_SHIFT               23* C1 D3 c3 Q! C9 }

  60. + y1 a' ]$ F% ]3 H3 o: L7 y- C# I
  61. static volatile int irqraised1 = 0;
    : z# m, `9 B2 e/ H* f2 O; E5 Q
  62. static volatile int irqraised2 = 0;% @! ~* S' W& K* I, \& ^( T. r
  63. * M2 h; X! B  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 N1 Z* G0 r- F4 f6 _) F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) c" A( Q6 I4 s8 H  [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # n: \7 P6 S( z& U; ~7 O: u$ L

  67. ( Y4 l2 l$ s5 d5 x2 J
  68. dma_addr_t dmaphyssrc1 = 0;
    $ Z; K* e% R5 W
  69. dma_addr_t dmaphyssrc2 = 0;
    - V2 q, E' e; \. p4 a2 e: e
  70. dma_addr_t dmaphysdest1 = 0;3 j* j* U0 _5 {/ r6 n- l
  71. dma_addr_t dmaphysdest2 = 0;
    ( U3 n- h# d7 V! J, i$ b4 g

  72. " s3 u9 r* ~% s8 P3 z; l
  73. char *dmabufsrc1 = NULL;
      }7 f* p) Y# p" P! A
  74. char *dmabufsrc2 = NULL;
      u! h/ b% b3 T; n0 }- O. p
  75. char *dmabufdest1 = NULL;
    1 v* ]7 s: q/ ~$ {2 G
  76. char *dmabufdest2 = NULL;. E" e- v% v+ _
  77. , m" f- P. ?8 P
  78. static int acnt = 512;
    % w: h0 \" g& x4 K, \: S3 H
  79. static int bcnt = 8;2 q: ]& K, L; ~2 e5 m+ P
  80. static int ccnt = 8;
    5 M: C- S3 f9 W# y* n' c' x

  81. * Q" s4 c( ~6 [. B
  82. module_param(acnt, int, S_IRUGO);
    7 i) X5 @! _% }( E( V0 ]' a( r( ?# [5 T
  83. module_param(bcnt, int, S_IRUGO);
    - `5 o5 l; q, `+ G* G8 D6 b6 O; ?% {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: k! K( e! N$ \/ K1 `+ }; a4 f. J2 s) z4 k9 X$ @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O" v* ^+ V6 ^$ p; x0 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ |4 d. `& a8 y4 S$ w* ^( }# q; Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, |# B7 ?  e# V# N  o/ d& a  ?. j
/ @% H2 q% _) `! j8 T" v) _0 y# L
; @' A) J" ?1 ?# `" t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 18:04 , Processed in 0.040640 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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