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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & b. p8 u5 P  v: b* r
  1. [code]EDMA sample test application" H) |& G9 ], p
  2. /*1 i% V1 `% r6 ]! s3 c! |8 A
  3. * edma_test.c5 y- g5 U0 f; u
  4. *- O0 F6 l8 {: r+ `- j
  5. * brief  EDMA3 Test Application
    ' F* _8 W' @. p# M3 y
  6. *+ A2 ~$ q; I3 }, e/ W# R0 e+ {3 Z; n
  7. *   This file contains EDMA3 Test code.  S/ p9 R# u# d8 q5 F
  8. *9 o# p8 K+ L0 u- W- M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) Q$ T8 `: a' `( j7 R/ s5 y  s- M9 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 l5 \3 E" y1 c" o7 R: U
  11. *         TO CHANGE.- L  O6 q) T% d0 Q+ m* P
  12. *. C8 `& p: q1 Y2 {$ i  }; p# u! E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 M! B! U- [+ D. }, `/ v5 n
  14. *
    " ^# }: o3 o' L" d. @% h3 i
  15. * This program is free software; you can redistribute it and/or
    : R; n8 D, T- Y$ Q1 X& j# `
  16. * modify it under the terms of the GNU General Public License as
    % x/ ?- L; l7 J+ ^6 i' A: j
  17. * published by the Free Software Foundation version 2.
    / @, W3 o+ o3 D. l. q- R" O
  18. *
    : b6 w1 P" K0 p. c1 |# _5 E& b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B' [7 D( f+ f3 h) g
  20. * kind, whether express or implied; without even the implied warranty0 y+ Y6 i" r2 O, J3 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : @6 Q1 x7 `; U& F4 J4 I- `
  22. * GNU General Public License for more details./ g/ I. |0 \9 |, W  b. O
  23. */
    9 x, u! V6 n4 p$ D9 U
  24. - p" G0 U9 u: y0 @# d
  25. #include <linux/module.h>
    9 S2 }2 D  Y; P* x! l& o
  26. #include <linux/init.h>
    1 o& T+ O- R3 G# \
  27. #include <linux/errno.h>5 W6 c1 n1 K0 h! ^3 P
  28. #include <linux/types.h>. U/ l) G. n# Q( n: N8 {
  29. #include <linux/interrupt.h>
    ( P% C* C9 r  a1 U; C
  30. #include <asm/io.h>
    ; J9 t( l) l1 t
  31. #include <linux/moduleparam.h>' K: ~  e7 E: e* A) p) N4 F7 K
  32. #include <linux/sysctl.h>
    $ E7 e! s: Q2 E1 G' E
  33. #include <linux/mm.h>
    * D3 S4 t  v2 l. D6 S9 ?4 d7 a. y
  34. #include <linux/dma-mapping.h>; z9 q! v% P+ o

  35. 6 f) x8 z9 Q2 ^/ T2 y: H
  36. #include <mach/memory.h>
    : F- o, D* g5 E7 E
  37. #include <mach/hardware.h>
    5 ]7 f% v4 }( e: N8 S0 v& X
  38. #include <mach/irqs.h>) g4 j: z" i' o# g8 F: c
  39. #include <asm/hardware/edma.h>; X4 v3 Z+ Q" o& c8 E; ~4 |4 V

  40. % b+ q% A$ q) C' k
  41. #undef EDMA3_DEBUG
    # W; Y6 D4 H7 t5 B
  42. /*#define EDMA3_DEBUG*/
    ! @8 Z* U& c) }" u% L* d, i

  43. 9 Z; r6 t: H6 G5 p5 ?2 ^
  44. #ifdef EDMA3_DEBUG
    ' E; b. O% T  D! t9 q& S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % }: e5 o; H3 M3 ]( o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). j' r, r5 {; C, X# t: ~2 J% j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + a. m& y- ]0 Y( K. F; ]! a
  48. #else4 e9 a7 `% v' k# ^7 j: E" o
  49. #define DMA_PRINTK( x... )
    " {$ K! P2 ]% C- I( e
  50. #define DMA_FN_IN
    ! A. i/ y! A( M* {/ h3 V: q
  51. #define DMA_FN_OUT  p6 B; G% ]7 m
  52. #endif
    # ?. X% y3 U; d, L5 A% \3 B3 [, @

  53. # J* z7 O8 M* H( Q' i* y. Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! m' [5 c  N. j) W9 D& Y  Y
  55. #define STATIC_SHIFT                3
      K& K: f0 R, Z7 d( X
  56. #define TCINTEN_SHIFT               20) g0 ], ^2 M7 g, l; D. a* A5 W
  57. #define ITCINTEN_SHIFT              21
    7 g+ Q* Q) k1 h) o- p3 z; p$ B
  58. #define TCCHEN_SHIFT                22) ]& U# Q% {( `
  59. #define ITCCHEN_SHIFT               23
    & Q, j+ Q! F5 ?% ^# `& P# A  H
  60.   D: I! K; A" T0 h! P- p* s0 h; B; C
  61. static volatile int irqraised1 = 0;. ]6 M8 T8 ^2 k- B' d# K0 |
  62. static volatile int irqraised2 = 0;3 z, k6 {6 u! u% G. x, V
  63. # A5 b/ @, e$ s0 H+ S* T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + |- K3 X! r# w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ~+ r2 k6 \5 |2 n' s6 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 K% W- L7 o$ t) o) d' I: P0 f
  67. 1 V& g  V. V7 x5 X, ~) `
  68. dma_addr_t dmaphyssrc1 = 0;0 a- w6 Z% m4 v/ l) X% d5 {
  69. dma_addr_t dmaphyssrc2 = 0;* S% N  ]7 R) f1 d1 n, ^1 U
  70. dma_addr_t dmaphysdest1 = 0;
    8 c9 Q. l9 G2 u6 A2 v
  71. dma_addr_t dmaphysdest2 = 0;% g6 G1 N8 n! z  A

  72. 7 E/ r- f: J) l( A, c: o( X
  73. char *dmabufsrc1 = NULL;
    : s  e  }: _$ c9 h& c
  74. char *dmabufsrc2 = NULL;
    ! \0 }: c- M' {8 y
  75. char *dmabufdest1 = NULL;5 H* P7 D2 r$ @3 c0 {* ]7 M0 o# R
  76. char *dmabufdest2 = NULL;# K  w  R/ f# O- W" s( o
  77. ( K, n. G+ s  W# v
  78. static int acnt = 512;
    " x4 A2 S4 x/ P2 U$ k, N
  79. static int bcnt = 8;& u0 ]' Y7 T) P' R4 T" T
  80. static int ccnt = 8;5 V3 Z" g8 ?( v# ^" n# G( O! W
  81. & z% Y4 x  w* e/ o2 f( K
  82. module_param(acnt, int, S_IRUGO);6 C$ F4 p/ x* _+ @1 a6 f9 M- i6 m
  83. module_param(bcnt, int, S_IRUGO);7 _2 N5 i$ @+ [/ ]+ k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! S( D6 V- P# S8 `! \! S5 h8 C

* f' y5 h, Z/ ]& E/ t, E& n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 M3 m6 H4 B2 H% Q, S- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~& S" a) u% _3 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 X* @) ?: N( Y8 n5 E* u0 \, O$ ]5 D3 u9 ^! N  n

2 B8 A7 Z6 r% F$ i/ y# J' G$ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 04:27 , Processed in 0.040804 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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