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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - m2 G/ _" F2 C7 _0 y) {) i
  1. [code]EDMA sample test application
    ! N7 h$ T0 n) y' i' x; D
  2. /*6 j; I8 A( Q4 Y( z
  3. * edma_test.c
    2 g; G1 k7 n+ o  v
  4. *
    " S% @; q* b- s) B4 L- C9 |
  5. * brief  EDMA3 Test Application: w- L& ~7 q: X( u
  6. *% g7 Q6 s  o' \; S  r- S8 f
  7. *   This file contains EDMA3 Test code.+ ^6 x# S0 m# N5 p/ Y; {7 R3 g! \
  8. *
    - p  [. y) c8 v( f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# E, `% ^2 s% U9 F6 Q2 ^& W: X% G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E0 _; T+ I3 M8 b
  11. *         TO CHANGE.) M4 F2 c. {  ~1 O. @8 L+ L
  12. *9 U( y1 A+ ^$ S* h, T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : N/ m0 Z4 a: b8 v: W& w4 F3 {
  14. *
    0 q4 Z" P) F2 N% P* f! [3 Z
  15. * This program is free software; you can redistribute it and/or
    $ J, m8 W  G& [0 Z# n+ K8 M  g
  16. * modify it under the terms of the GNU General Public License as. Z4 n0 m, k- Y8 ^& O
  17. * published by the Free Software Foundation version 2.+ t  y# O9 Q2 S+ b- |
  18. *
    % T% k7 ]) l7 R/ W- V0 G* ?% C1 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& o% f% S5 Y* b5 q& L
  20. * kind, whether express or implied; without even the implied warranty
    , y" j) R) N" ]# ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* o9 A8 m$ H& a# I
  22. * GNU General Public License for more details.
    * ]$ q9 O& b% |, {, L" o
  23. */
    * A9 [& |! C* p, d5 i; r8 A
  24. 8 ^. ^: n! m: ?8 x
  25. #include <linux/module.h>
    8 b) ~2 {3 `5 y1 d) A1 d' ?3 R
  26. #include <linux/init.h>3 V" M2 O, N' ]! l; A
  27. #include <linux/errno.h>3 u+ K- X1 e  ^% M9 Y0 G5 V, }$ T
  28. #include <linux/types.h>
    ( C5 L6 `6 \) R: {- n& \
  29. #include <linux/interrupt.h>3 c$ t9 F/ {' \
  30. #include <asm/io.h>
    ; P3 K1 G* H  T+ g7 w/ v, p
  31. #include <linux/moduleparam.h>
    7 }  T4 r+ d2 T6 R1 \& z
  32. #include <linux/sysctl.h>/ ^( {1 I* w/ w4 X3 z! G
  33. #include <linux/mm.h>
    4 L& o; ~$ y/ M/ Q" X
  34. #include <linux/dma-mapping.h>  o9 V, n" n4 L

  35. 2 F/ S7 A! a' e4 I. {
  36. #include <mach/memory.h>
    - p& q3 O5 k( G
  37. #include <mach/hardware.h>
    1 @2 y$ Q) c. o) S- ?8 I
  38. #include <mach/irqs.h>
    $ H- E1 Q, }8 T# c
  39. #include <asm/hardware/edma.h>
    - u  H) M+ ?% k; q  ?
  40. ! r7 G; N$ N/ @2 J
  41. #undef EDMA3_DEBUG: T8 E# a! j: O. h' P' V/ y
  42. /*#define EDMA3_DEBUG*/- b0 L6 j+ ?/ G& r5 a

  43. + V( c, o9 Q6 v+ l4 b, d2 l) \/ m
  44. #ifdef EDMA3_DEBUG/ Q$ e! X; m$ d6 {% X/ x" n& @" |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); P+ Z; g8 u  m7 ?! C$ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 m: W3 G" b( F0 E* i# u" F; R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # e# B$ c" Y7 }  t4 s' M
  48. #else
    # J, I8 M1 h! d% J2 u2 Z
  49. #define DMA_PRINTK( x... )
    ) G3 X1 M& n% i* r" Z- r7 g
  50. #define DMA_FN_IN3 K2 c  V4 a* C6 n& E5 J2 {" k
  51. #define DMA_FN_OUT
    / k# j6 v+ ]/ X7 p0 ?0 n
  52. #endif0 M6 W( [- V" \( \! s

  53. 9 k4 Z3 G4 P! y9 @  h/ S4 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  H* u4 P2 K  ?% {0 N
  55. #define STATIC_SHIFT                3
    ; P1 I5 r! ]# V# {5 M
  56. #define TCINTEN_SHIFT               20
    * S4 o( K2 H6 o7 }4 I8 m+ _
  57. #define ITCINTEN_SHIFT              21% J* h" b" r0 c
  58. #define TCCHEN_SHIFT                22
    6 y: Z. I% O0 i9 ?( F8 m3 w
  59. #define ITCCHEN_SHIFT               23* c+ O1 I, C2 E, k

  60. 8 Y6 S, g8 E, S; M; a4 ?
  61. static volatile int irqraised1 = 0;$ E* n: p7 y! q/ i# g
  62. static volatile int irqraised2 = 0;" O2 Z1 m2 [& _7 c# q! C

  63. ' W1 G4 N' j  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # b7 J) ]# O; w  F! Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 \5 ~$ A( z& j$ ~" ?5 `2 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N6 H& P* i3 l
  67. + h$ w2 H8 S, G9 @/ H, M2 `
  68. dma_addr_t dmaphyssrc1 = 0;1 f" ], b/ n6 Z; Z$ p
  69. dma_addr_t dmaphyssrc2 = 0;9 m, ~( C: Q( c  H* l* g: D
  70. dma_addr_t dmaphysdest1 = 0;: U  e' u: G2 a. I4 k7 W' k' r
  71. dma_addr_t dmaphysdest2 = 0;: K. L$ l7 \2 J" B
  72. / H% F) P# z2 k! P
  73. char *dmabufsrc1 = NULL;
    / B. U& L# K1 I
  74. char *dmabufsrc2 = NULL;
    - X* H/ n9 q3 Y: J, y
  75. char *dmabufdest1 = NULL;
    ; U0 p% E# k! r+ P8 ]6 L. \
  76. char *dmabufdest2 = NULL;7 a$ s8 I( B! v3 O, y

  77. 7 n" L0 V8 ]- J' E. P5 W
  78. static int acnt = 512;; y6 _' h# l9 r6 t7 M. L
  79. static int bcnt = 8;
    - z, [; [5 L1 R! R0 g! q
  80. static int ccnt = 8;# D. j& O8 h) n9 ~
  81. 3 D0 E/ I! b. c* C3 M. m
  82. module_param(acnt, int, S_IRUGO);
    6 x  R* S9 t) l5 {: Q4 b8 a
  83. module_param(bcnt, int, S_IRUGO);
    3 N" p" U" m' [9 w3 h7 C, O8 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  R: z" G7 o' F

0 d2 `  h' y! a9 u1 W2 N( l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 r* r, h: |6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 G8 t& z9 R3 }9 D7 v& Z/ y3 K0 I. N9 J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k. v4 a) z& o3 W; A8 ^
0 S- J- i4 U$ J0 @
& v, I2 X, X( z+ C2 V3 ^+ D, W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-30 14:19 , Processed in 0.049205 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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