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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! `  \6 p3 G6 q: I& K
  1. [code]EDMA sample test application
    ! O- B" ^8 W' v5 X+ l" o) p
  2. /*
    - c4 m, M5 p8 }1 v" i
  3. * edma_test.c; I; P# ]# Z' f9 h2 f, x/ H( O) f
  4. *9 B; Q) b* |7 D* P
  5. * brief  EDMA3 Test Application# x3 e/ D& e/ Q3 D
  6. *3 \: z0 c/ W2 Z7 H4 \2 s
  7. *   This file contains EDMA3 Test code.4 b$ p2 a8 R+ u
  8. */ P  h( p$ r6 o5 L/ u2 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* H8 y$ i: Z4 f* h# x  U, @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( x6 S* R7 B: V$ {
  11. *         TO CHANGE.( u7 F1 }" s1 a9 D& B& b( A
  12. *) \4 M# o3 U2 P, i+ x0 y0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- n) w! ^* z0 s2 {( I5 H
  14. *
    3 z( ~8 s$ }# {. I/ W
  15. * This program is free software; you can redistribute it and/or, w8 S; k! b* W3 y0 t" Y
  16. * modify it under the terms of the GNU General Public License as- S4 f4 u& ?/ L
  17. * published by the Free Software Foundation version 2.
    7 \% ?  d: x; p# h9 k( P
  18. *# c7 u- ]0 o7 ]& V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 u7 U1 N' ^3 q% K3 ^8 P$ L
  20. * kind, whether express or implied; without even the implied warranty; W) k( m1 Y" Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. I/ Q5 o' M/ S  {5 Z& g
  22. * GNU General Public License for more details.
    + p( P$ U0 Q% p; Y) R+ ]7 h- N; n
  23. */
    ' ~2 N# {0 [8 l2 _& T, Z. j' {

  24. ( x  W3 V, L$ [/ p9 u  g6 a
  25. #include <linux/module.h>
    ( N; W6 W, W  ?& d( e1 ]
  26. #include <linux/init.h>) w: Q; z. U; }1 f5 q8 T
  27. #include <linux/errno.h>
    ) G* L! K6 P' p3 Z4 R4 K: |
  28. #include <linux/types.h>: A4 J0 B' J- e8 ]1 E
  29. #include <linux/interrupt.h>
    % k5 q" p/ J- y0 A  m4 Q  I
  30. #include <asm/io.h>
    1 Q) |$ ^6 D* t  S7 c1 Q
  31. #include <linux/moduleparam.h>
    ; @+ B) e  N$ \1 V
  32. #include <linux/sysctl.h>  r: ]% F3 K) h) T% h
  33. #include <linux/mm.h>8 z5 q) b+ C+ w3 `5 v+ R
  34. #include <linux/dma-mapping.h>
    1 ?7 H( L: z1 p' R( E$ q" C4 x

  35. $ A9 F( I' z  J5 K: {. L
  36. #include <mach/memory.h>' D$ l1 \9 `" L2 t
  37. #include <mach/hardware.h>! C( q; x4 A1 u6 B$ p
  38. #include <mach/irqs.h>1 g" B) H( C7 [( y# b9 y% K# o/ M
  39. #include <asm/hardware/edma.h>+ B; R/ X+ _$ ]2 b  U

  40. & \" u5 s; V/ V7 e
  41. #undef EDMA3_DEBUG
    2 [: M% O+ t, [+ K0 F1 |7 `1 V
  42. /*#define EDMA3_DEBUG*/& X( [% ~% }# n5 }

  43. ' e* f# R) y) t
  44. #ifdef EDMA3_DEBUG3 Q2 H/ o" `4 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( F/ A2 R. }+ K! p) [* ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . m6 R0 r5 |  Q9 Y( y' w* t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% J! @" I' a( g# [4 R' _
  48. #else: n3 S0 S" s1 ]/ y8 z8 U" k; U
  49. #define DMA_PRINTK( x... ); ]" x' U  V2 b8 Z" W9 k2 ^
  50. #define DMA_FN_IN" w5 |$ d0 y/ q# P2 {$ y$ @
  51. #define DMA_FN_OUT2 N" D( Q; C! Q6 S* X9 J$ f* z* k
  52. #endif$ X7 ]. V, {9 P. b. x. E$ m6 @$ A! c

  53. * ^" b& U- L. E+ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & A- [  `/ a  z8 l3 r* n$ R2 v
  55. #define STATIC_SHIFT                3
    2 x" u% N, C& m& z0 \9 f
  56. #define TCINTEN_SHIFT               20# F4 D" \0 E! x6 D) F8 N. P
  57. #define ITCINTEN_SHIFT              219 x* \+ W! g( n4 y$ t% }- }+ _8 W
  58. #define TCCHEN_SHIFT                228 X: h1 j) Q' q5 I( \9 |5 n
  59. #define ITCCHEN_SHIFT               23
    & L4 x! J3 e- X9 s
  60. : f" J6 Z. w6 Z. v0 |, ]+ x
  61. static volatile int irqraised1 = 0;
    ( h$ n# Z0 H9 a- ^
  62. static volatile int irqraised2 = 0;6 L: C. u) R# j

  63. * [8 U1 T+ Q2 ?" K! W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d) H4 R6 A$ s) t& V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?' ~' M9 b; h( E. H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G; c/ ~  m* h$ f
  67. # B; V. N6 o' B. s' J6 i- ~1 ?
  68. dma_addr_t dmaphyssrc1 = 0;; v0 N8 I) ^" S7 j
  69. dma_addr_t dmaphyssrc2 = 0;  r0 Z1 D  |, I# B4 B+ b
  70. dma_addr_t dmaphysdest1 = 0;$ T/ y9 @7 @' q0 [/ n5 v
  71. dma_addr_t dmaphysdest2 = 0;
    + ]  q/ N$ p; z3 `3 u
  72. ( x8 }9 H( p! `, C% c& w" W
  73. char *dmabufsrc1 = NULL;
    * p& D7 U9 P) {, Z& L
  74. char *dmabufsrc2 = NULL;
    ! b# ]8 t' a" p* R! ]1 |
  75. char *dmabufdest1 = NULL;: [3 v4 z- |0 \! w1 D
  76. char *dmabufdest2 = NULL;
    * z* M5 A, m/ Q2 [9 \& ]7 \  ^
  77. 0 K/ a. |7 a5 M
  78. static int acnt = 512;
    8 D) V9 v/ O" f! @  g( `
  79. static int bcnt = 8;
    9 ?. w" R% S8 e% K! |8 S% I* X
  80. static int ccnt = 8;
    + j5 c$ _  C( C& f; Y

  81. % |. W/ @' o# V
  82. module_param(acnt, int, S_IRUGO);! [7 ^' P, w& ?5 T3 R* o! ?' z
  83. module_param(bcnt, int, S_IRUGO);
    ; X  M9 y0 X0 ]0 q7 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 d7 U: B5 f& W: x8 R; B" h

7 ?: [& v$ {4 T, A$ q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) g9 t' b- E. b/ s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u  B, `% T  B- V/ H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! p, Q  ~! }/ g8 d& j

2 d2 @% k$ N" G0 S; w
3 a  G2 X  b2 j( n$ _, N  C7 n# D" {" y3 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:39 , Processed in 0.040879 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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