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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o5 Z" j, _8 ?( F- \/ u
  1. [code]EDMA sample test application2 I) A5 O; t9 ?* q2 O1 s  i
  2. /*& v1 C0 R. S5 x, g$ b7 u
  3. * edma_test.c) R' v: B6 p& \" u3 ?8 d9 M+ N
  4. *2 n% _" j# n6 R0 p9 }, n! x/ J0 Y
  5. * brief  EDMA3 Test Application1 x5 s2 t. a0 l: L) a  I+ n
  6. *
    - [' q4 m2 ]+ a8 K3 u% |
  7. *   This file contains EDMA3 Test code.' A1 r0 Q/ Q: s$ j- ]% E
  8. *" d2 a/ o( \' g; C, m- u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 l' H  [( A7 j  Z) M; L$ F6 v  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , {+ L* e) ?6 h7 V
  11. *         TO CHANGE.3 T0 _- O# S7 r1 g
  12. *4 M$ }- y* i1 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~" P# S6 Q% l" I
  14. *
    . Q0 N* @9 ~9 `6 C4 u9 r( |
  15. * This program is free software; you can redistribute it and/or8 I5 E# k& D* k# k- X5 w
  16. * modify it under the terms of the GNU General Public License as
    ' l3 Z( O! R% u+ U& Q
  17. * published by the Free Software Foundation version 2.
    $ V+ R7 p* W  i! o! G5 Y
  18. *0 P7 n3 n. ^$ b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ?: ]4 y: `9 h7 a
  20. * kind, whether express or implied; without even the implied warranty
    ' f. a. A$ `4 y5 N5 I/ `! e7 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 W+ {, X" X$ Q" D5 s
  22. * GNU General Public License for more details.
    ; d, b- f& |$ W) r! B) Y
  23. */) V8 w# k* N8 [; d

  24. ; O4 p1 q! U. ]2 \
  25. #include <linux/module.h>7 A9 \! y) Z7 a
  26. #include <linux/init.h>- Y) \0 s3 n* l& r
  27. #include <linux/errno.h>
    7 d" V, v- C1 Z
  28. #include <linux/types.h>, W, J6 J: o$ w* C) a
  29. #include <linux/interrupt.h>
    ! B( Y- @, R9 O! a
  30. #include <asm/io.h>! x# M- N% _0 U
  31. #include <linux/moduleparam.h>
    . x, p1 x& {1 ~* V5 z
  32. #include <linux/sysctl.h>
    ) }9 U5 ^1 V9 ?# @, B8 q5 S
  33. #include <linux/mm.h>
    . R9 Z0 z! z4 e  n. I7 l! E
  34. #include <linux/dma-mapping.h>
    3 ^/ U& I0 p5 k1 X

  35. 7 H1 u, T7 c3 N# ^% H$ z
  36. #include <mach/memory.h>! I, T9 `6 n& x) P# r
  37. #include <mach/hardware.h>
    ' @- B9 x' p; K
  38. #include <mach/irqs.h>
    0 [9 @0 w* B+ |* w* x
  39. #include <asm/hardware/edma.h>! X1 O. b! L( p. o
  40. & C2 l9 b% [0 q. p# ]( M: k
  41. #undef EDMA3_DEBUG
    2 o2 q' K) g: N, m) Z9 a$ a. R. S
  42. /*#define EDMA3_DEBUG*/: \/ L) Q+ U4 J; \2 Q
  43. ! l4 v4 d% q" f' J( A& M* Y
  44. #ifdef EDMA3_DEBUG$ C5 v2 v) b- ~$ t; T6 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" d, W; a0 n* \7 S8 B! O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 N8 E% F% a" d: ~$ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 b7 |4 \7 Z$ I
  48. #else. |  p( w2 t1 \6 z4 _! m! n
  49. #define DMA_PRINTK( x... )
    " Z8 y5 V" T7 F/ f0 \4 {( V
  50. #define DMA_FN_IN4 Q2 m6 g6 F% n% l; a- D
  51. #define DMA_FN_OUT
    2 O) n) Q# m9 z3 `) f
  52. #endif
    5 F+ T( N% g4 T, L2 f1 k: A; A

  53. * U2 q9 H  j, J+ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' g; K8 [) ?7 n2 }: @! M5 }. J
  55. #define STATIC_SHIFT                3
    - d* K" G8 A! v3 w- {8 Z
  56. #define TCINTEN_SHIFT               200 l- N4 x, j0 r2 _7 k6 C
  57. #define ITCINTEN_SHIFT              21
    ) n5 V$ h0 F1 h, r& w
  58. #define TCCHEN_SHIFT                22; m+ z2 V. ?# d) `
  59. #define ITCCHEN_SHIFT               23
    0 p# d; }# w" p& T" k$ F* n8 S

  60. * a/ @5 T: x# U
  61. static volatile int irqraised1 = 0;' |' F# X- @" l) c# r8 Q
  62. static volatile int irqraised2 = 0;
    3 s; p$ f; W7 t
  63. 8 M$ B% f* ]5 e, @2 ^4 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r! O/ s# v+ j+ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) J9 |: @( q0 \( ~. l' F# u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E7 z  ^! j% d2 E) X. w

  67. 6 N4 [7 Z- D" Q& ~/ n
  68. dma_addr_t dmaphyssrc1 = 0;
    $ H& i5 x$ U0 |# R/ R/ a3 z
  69. dma_addr_t dmaphyssrc2 = 0;; G, h! _: J* S. Q, n9 d# A
  70. dma_addr_t dmaphysdest1 = 0;
    . c) Y5 r, ]$ Z& U
  71. dma_addr_t dmaphysdest2 = 0;+ P. }& t; @  {3 o: R

  72. ) j& C8 Z$ c! k
  73. char *dmabufsrc1 = NULL;
    ; t! n: K: k* Y1 n* V1 s
  74. char *dmabufsrc2 = NULL;5 V" v2 S/ U+ B2 y. N" ]; a
  75. char *dmabufdest1 = NULL;& V; a+ a1 @) {+ @" \! ]4 t
  76. char *dmabufdest2 = NULL;# f7 J/ ^! u. l, |, Z9 \

  77. 7 H. e  K2 J/ ]4 ~% A7 @; `; y% `1 M7 B
  78. static int acnt = 512;/ P1 Z4 D* @  |# w6 E2 O: f0 V
  79. static int bcnt = 8;% |' h) P4 Y, W2 ], [
  80. static int ccnt = 8;" Y9 \8 D) c+ H, {4 }' x, x* N
  81. 8 `. t1 J9 X4 l2 S# Z7 \: f# Q
  82. module_param(acnt, int, S_IRUGO);0 T9 q, z. ~" ^
  83. module_param(bcnt, int, S_IRUGO);
    1 L2 t6 n5 _, y8 a# ^2 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* z( p! n0 ], V4 a
( Y, k( j5 M: c$ x8 ^3 n5 H+ h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V* F9 n/ Z, H5 C6 a
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 [+ ?' }, ^7 e' [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 l+ l# r+ @2 V5 i
8 j) C) f( e! W: c& \; I9 {
- O! i( _5 L8 F# V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 14:21 , Processed in 0.038497 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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