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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ~  ~# a- n. |. F9 G$ m
  1. [code]EDMA sample test application% s1 [1 Y. L0 `* @' @; z
  2. /*
    9 I+ U0 ^; n; r6 o* O' P
  3. * edma_test.c) @* f. z, S  J0 r7 O8 e* ?9 m4 r
  4. *
    ' K; Q, j' a5 J; H: U6 _
  5. * brief  EDMA3 Test Application
    ; r7 }! C8 H9 z( I* e/ I
  6. *
    " W; B) e  b, o; S
  7. *   This file contains EDMA3 Test code.6 X% ?0 g- f+ W( I
  8. *! ]6 ^3 M+ Y$ a# H- @" U1 V5 N* S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- J+ x1 U$ `! D5 x7 o$ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; ~7 e( p! F) H7 c& [
  11. *         TO CHANGE.
    $ ]# r  F* U  G* i: V8 g
  12. *
    4 j- T9 K( U( }. C7 w, l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 j$ |+ Q0 {) C0 Q# S
  14. *
    , q0 e( b% V1 S! i
  15. * This program is free software; you can redistribute it and/or8 p" u/ g0 w1 B
  16. * modify it under the terms of the GNU General Public License as
    0 l% f0 k: m, U1 |. f7 L: s* v, p2 M
  17. * published by the Free Software Foundation version 2.; c0 i2 u  l/ v
  18. */ L; N7 J2 ?1 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( M1 N5 i7 q0 Y- w( H) |3 j/ w
  20. * kind, whether express or implied; without even the implied warranty
    " W& R# I% t+ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' \; n0 H9 F4 ~% {
  22. * GNU General Public License for more details.( N/ o% {" A+ K# A4 L( \/ n9 `3 g( {& X, \% j
  23. */9 X# }; i& L4 s9 e  @7 j/ ~7 v

  24. . _/ K, C: Z! M& T6 o' _4 p2 [
  25. #include <linux/module.h># [" C( Z+ p: \' S0 F& n( c6 a
  26. #include <linux/init.h>
    ' G, }3 {/ I1 u% R- y+ `& a  R
  27. #include <linux/errno.h># J! S% k  ?7 A
  28. #include <linux/types.h>; q5 y7 R9 @- [0 @
  29. #include <linux/interrupt.h>% Y! I9 `/ m# ?" U& R1 h
  30. #include <asm/io.h>
    8 l/ f+ \3 Q9 ?
  31. #include <linux/moduleparam.h>
    / L* ?  h- N- H* O4 z: m7 u6 e
  32. #include <linux/sysctl.h>( w7 ~* h- J) [8 Y* w6 g
  33. #include <linux/mm.h>
    : L9 ^' s8 q% V* X9 Z
  34. #include <linux/dma-mapping.h>
    & a* w9 {9 l% F$ y+ t" M

  35. 6 t' K' e, v  M+ w, P- u
  36. #include <mach/memory.h>8 ]) g$ C8 u, U1 h: v
  37. #include <mach/hardware.h>4 T8 a5 f' b* r. ^6 L
  38. #include <mach/irqs.h>9 H+ X+ E5 q, x$ C: _7 I2 u
  39. #include <asm/hardware/edma.h>6 I1 T0 a: d/ T8 C, L. Z1 ~

  40. : \# ^) @4 q' ]$ J
  41. #undef EDMA3_DEBUG
    * p% S) R" _4 x3 f. @
  42. /*#define EDMA3_DEBUG*/& m7 s1 P6 F+ u0 u  \; x( D: Q" T
  43. " Y7 h" J. S7 }0 o/ L( r
  44. #ifdef EDMA3_DEBUG
    - E: M9 c& q2 z: G2 @! x' Z& z/ M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & }, _$ _2 Y0 s  o" F1 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o. `, Y0 y& X. x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + b; j0 S7 X: i
  48. #else$ m: j( K( Z3 Y0 }* P
  49. #define DMA_PRINTK( x... )
    / O0 j1 V8 z+ f1 ~
  50. #define DMA_FN_IN
    4 J* A; G/ y# f6 j
  51. #define DMA_FN_OUT
    " e3 d  q0 ?% X: I9 `# h1 i
  52. #endif/ Q1 w$ W8 k9 W0 v! X" X' l1 W( T1 A9 T; U

  53. & l" c2 Y; i9 z2 Y5 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Q* D4 ]3 h' i# h' |/ l% U( B
  55. #define STATIC_SHIFT                3
    + ?2 D) P2 R' w. f
  56. #define TCINTEN_SHIFT               20
      d, C0 A+ w8 E
  57. #define ITCINTEN_SHIFT              21" L$ {( }$ A  B9 [# r6 }% B3 T' X
  58. #define TCCHEN_SHIFT                224 V! h) L" M3 l# F1 l  K5 j
  59. #define ITCCHEN_SHIFT               23
    1 Z' A' Z) X, j3 J

  60. , @* c/ y" g  U3 @' L* I
  61. static volatile int irqraised1 = 0;
    " K) ]7 f7 y# n: [! K$ u, k" h4 k
  62. static volatile int irqraised2 = 0;( D- N9 P9 {, a- E$ y8 e

  63. ! w- W6 t  a! e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~# H, i* ^) f+ ]0 T! h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 T$ i8 F3 O9 G# V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G* T2 T# U2 Q" K+ P, O

  67. 8 Z  j7 a. w- Q7 |
  68. dma_addr_t dmaphyssrc1 = 0;- e& Q3 w0 J1 r: ]
  69. dma_addr_t dmaphyssrc2 = 0;/ l5 V; n0 B4 t, F7 p: s
  70. dma_addr_t dmaphysdest1 = 0;
    " R; _3 W) B0 l& p* r, K: P  w
  71. dma_addr_t dmaphysdest2 = 0;. E5 o5 [" w0 ]- M) _" y

  72. 4 y/ [( u/ T' R" B* o; b6 q
  73. char *dmabufsrc1 = NULL;
    / {) T2 Z6 `5 |9 P1 m; n( l9 d
  74. char *dmabufsrc2 = NULL;
    " R; B$ Y# Z' ?
  75. char *dmabufdest1 = NULL;
    " A  h( }! b' V, r, |$ j7 S
  76. char *dmabufdest2 = NULL;8 W2 k5 k) f- S

  77. # b, x+ ?" l5 n. n' |5 U
  78. static int acnt = 512;
    , L2 F$ }+ b5 J) i, N$ z% I  t
  79. static int bcnt = 8;
    # [2 {5 @- p! U' T$ c" d4 x
  80. static int ccnt = 8;: N* X7 n: f* r! N% g
  81. ( o/ l, c* l6 a# \$ `. D$ ?& l
  82. module_param(acnt, int, S_IRUGO);, `* Z2 y% @( R, C; y6 p
  83. module_param(bcnt, int, S_IRUGO);
    4 U9 Z& r- E6 ?4 ~8 q# e7 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 O7 D  @0 H6 Q7 j

% q% |* N2 r4 \; H, P0 K6 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 B. Q9 S) `4 p+ q2 w, o! _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 w2 `. I; d) M. H2 _0 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& c7 M6 w1 L, n; \

- u/ R9 J4 C0 g9 l6 F2 @% s, m6 ^; q. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 01:15 , Processed in 0.039370 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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