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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O: f9 j# S" l0 \( }: X
  1. [code]EDMA sample test application
    * i% V# `# y* d; G* {) u  X& z
  2. /*$ K4 T# s: H7 t% K' w
  3. * edma_test.c5 I( j  ~9 B5 r. x* u3 M
  4. *
    5 f% l2 _7 m! o
  5. * brief  EDMA3 Test Application
    ! S3 R: O/ G$ b/ `: E
  6. *
    4 d1 r5 U, J5 }; A, M
  7. *   This file contains EDMA3 Test code.
    $ T0 S# l( ~. I& d
  8. *
    0 \) a, d  K( K6 Y. r& W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" S9 @9 z! t3 @0 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 }0 B' p, y0 j; l2 {/ j% ]( t
  11. *         TO CHANGE.
    # Y% B/ ~: r% ?1 a2 D1 h4 ?' P
  12. *7 X) M# A% o) m+ T3 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: \1 ?3 X; t% Y$ N
  14. *
    2 E0 K  \2 n, G1 H
  15. * This program is free software; you can redistribute it and/or/ R* `; r7 l! f: v
  16. * modify it under the terms of the GNU General Public License as4 K# {( w& L+ z
  17. * published by the Free Software Foundation version 2.
    ! S5 y7 z+ A& r7 p5 a# A; |
  18. *
    8 a1 Q; A6 L$ ^5 H8 `' m# s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ~! T+ p9 }  K* ~% N/ Q* t& i
  20. * kind, whether express or implied; without even the implied warranty
    4 F! ]* t& o0 N/ _3 K% @7 \) h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 C  _+ ?! V7 e* X- o5 E
  22. * GNU General Public License for more details.
    ; F4 t) F( Q# m' [; h; L% G
  23. *// K$ W: e9 q9 @

  24. , k! Q* H) a# G$ p1 Q8 O
  25. #include <linux/module.h>" O1 M6 i3 L- t0 y$ D) ~
  26. #include <linux/init.h>
    & @3 V* u! G6 w$ s7 j* r# R- ?% n6 O
  27. #include <linux/errno.h>
    ' q5 D; h+ ?8 d3 L  _
  28. #include <linux/types.h>! `* v/ C* ?+ a. J6 Z) B; o- x
  29. #include <linux/interrupt.h>) `- j! c. j1 G% s
  30. #include <asm/io.h>
    ; z1 B! e4 C1 n. ~0 O0 O$ x' A
  31. #include <linux/moduleparam.h>1 }. K9 s0 \8 J$ d
  32. #include <linux/sysctl.h>/ p# E$ I6 A( e# k& Z: l: m: B
  33. #include <linux/mm.h>
    $ S  n1 G2 n, V+ {
  34. #include <linux/dma-mapping.h>
    0 X; {8 r$ ]" T" Q  N# B% c

  35. 4 p2 h! [$ T( k, J7 N) s+ `$ f
  36. #include <mach/memory.h>+ E. P% m& p9 b1 v
  37. #include <mach/hardware.h>1 c8 H( Z+ C  J& v; _$ B/ W$ n3 K
  38. #include <mach/irqs.h>
    0 |* z9 N* \/ o
  39. #include <asm/hardware/edma.h>
    & @2 @: `% H) e' a- U& R0 B6 R
  40. % u9 b" w9 _4 E
  41. #undef EDMA3_DEBUG
    6 a- c& g$ V/ q6 O0 F5 E9 C
  42. /*#define EDMA3_DEBUG*/1 \3 f) }0 ~2 x
  43. 7 E1 Q; v, t4 e, J3 p  U: T1 q
  44. #ifdef EDMA3_DEBUG
    8 M8 @. |/ W6 U+ O* ^4 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 X/ u- [$ U! q' `  R; B5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" r: q: `7 {1 G  q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N$ m) y$ o6 i" C
  48. #else
    : H6 Y3 W; v! s
  49. #define DMA_PRINTK( x... )1 z9 u. L) Y2 H/ Z6 w2 K1 U1 g% V
  50. #define DMA_FN_IN( \+ ]% U+ Y7 O" c
  51. #define DMA_FN_OUT
    . z0 g) L1 ^& R8 H
  52. #endif
    4 L) Z% q) s" q) x4 x) e. R7 U/ U
  53. ( ]4 \; `  Z' F3 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ g5 c7 s9 [& v4 F+ ~4 r
  55. #define STATIC_SHIFT                3
    * i4 {9 E/ M. p
  56. #define TCINTEN_SHIFT               20
    & @# G9 w  s. y
  57. #define ITCINTEN_SHIFT              21
    + A  @) m, o0 E1 \( m& F
  58. #define TCCHEN_SHIFT                22
    & b# w& K' v3 X( Z3 f! _
  59. #define ITCCHEN_SHIFT               23: Z1 |" X# b$ ]7 U4 r! T0 @
  60.   v  C' m" l  Y. W# m
  61. static volatile int irqraised1 = 0;( K! I% u# W1 w+ Z. v* n
  62. static volatile int irqraised2 = 0;
    7 f* |: P& K" w. M# o9 [
  63. 1 Y- e2 R5 y8 G& r8 ?! e" A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u( N# v8 I% q; H7 ]: n4 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 I/ R; c, F3 q- k$ n' g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z- ?6 v  H/ J# O% I: ]7 s- S. w
  67. . H) o# U' u* F6 Z. v  P/ ^
  68. dma_addr_t dmaphyssrc1 = 0;
    " `, |0 n! |2 x& Z3 ~# B9 j
  69. dma_addr_t dmaphyssrc2 = 0;% P" e# a) o8 ^8 p
  70. dma_addr_t dmaphysdest1 = 0;
    + h6 s3 M  M# y$ ~6 r. a  ^
  71. dma_addr_t dmaphysdest2 = 0;4 ?; I+ ]+ T  Q$ L! J4 y' s$ L
  72. . f$ G1 j* T$ C7 u; I
  73. char *dmabufsrc1 = NULL;
    , k; A, i) m* K$ x+ r; [
  74. char *dmabufsrc2 = NULL;6 K$ N9 a* V- S* g. N- _
  75. char *dmabufdest1 = NULL;* I5 q( U, H* ]! O0 i! _
  76. char *dmabufdest2 = NULL;3 i+ u# m6 v+ a0 E# v, V& {! a

  77. ) ^6 S  I( a' |; {' p) ^4 W
  78. static int acnt = 512;  a0 ~* S8 r- I. k/ e4 H- J& R5 P- R) m
  79. static int bcnt = 8;
    ; \7 p$ k% i2 W  T
  80. static int ccnt = 8;$ q6 |  a9 G7 R7 d: R% J
  81. ; |0 g7 G% |8 J7 D5 A
  82. module_param(acnt, int, S_IRUGO);
    + R. r6 W; X2 y7 n. W8 w) \
  83. module_param(bcnt, int, S_IRUGO);
    ' X! ]6 j4 u; L3 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% w- k+ M; V% d6 W5 i* y* e# e

% |) T  d& Q3 I) I2 b  L" E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  F& V1 P  Y0 a0 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# E1 B4 {# B/ c5 r3 b( Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: V' c+ t7 \8 I4 b1 f
# s1 |! Y  h. {! a1 G6 C: L; j2 ~' S2 j2 o& A3 b' I; ^: ]! B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 16:14 , Processed in 0.039571 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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