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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, z5 ^. p1 ^6 J% g& K; b7 [
  1. [code]EDMA sample test application1 u7 W: \! Z% h2 v5 ^4 D' o
  2. /*
    8 W. Z4 {3 U) D% t
  3. * edma_test.c
    3 t  k" H, N$ y0 l, Q3 C
  4. *. L/ k6 N* X% g( j
  5. * brief  EDMA3 Test Application
    + Y- _- F% V/ @: _( [
  6. *+ w2 x( e$ q$ |; S: N
  7. *   This file contains EDMA3 Test code.
    - w6 M+ v6 U7 u9 s
  8. *7 [7 S( d7 j: J0 Q# [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 |% ~  p7 g+ {) E0 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f# @7 m8 Q% Q1 S: o
  11. *         TO CHANGE.% b- L' {' o. _- c' U! C
  12. *7 @3 R) m# {1 _4 Z9 R$ |$ s% h2 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - q' [: ~/ c. f  Z- v
  14. *
    7 @: D' g$ |0 t5 D$ B
  15. * This program is free software; you can redistribute it and/or2 e; w9 r: }7 O) M
  16. * modify it under the terms of the GNU General Public License as# s( D* G8 H  D% E  l( G
  17. * published by the Free Software Foundation version 2.
    ( p6 E4 J3 W/ Z2 X6 B! _& _
  18. *8 V3 |% ~9 e  y. T  K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ^( q0 Z2 J5 L1 I
  20. * kind, whether express or implied; without even the implied warranty
    , ]( [/ k! B, U2 L4 z' }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# T1 H0 M/ D0 g" g7 B( ?
  22. * GNU General Public License for more details.# v% `/ }# T4 h, V! E
  23. */& n" u2 i% o. g7 `% z  i+ j; O
  24. ) S/ g/ r) a% {4 `/ \# O
  25. #include <linux/module.h>
    2 a4 q) |# j, w$ e; E% m, ?/ Q- A& A
  26. #include <linux/init.h>' D; L, Y  ?  j8 j- S( r! J
  27. #include <linux/errno.h>
    " `, U0 M' [! Q
  28. #include <linux/types.h>
    * M3 E  G: s+ D- m4 g
  29. #include <linux/interrupt.h>
    * p* P1 O8 N# D* Q4 ~% f
  30. #include <asm/io.h>
    2 L" c% J/ D5 U% d/ c* O
  31. #include <linux/moduleparam.h>( b, a/ K" `+ c6 @6 h2 Z! i! l
  32. #include <linux/sysctl.h>
    ) Y2 V; n! N" \( M
  33. #include <linux/mm.h>
    - O$ ?+ w, B. o$ G& O( I/ X# w
  34. #include <linux/dma-mapping.h>
    + [0 D% X4 \- ]) L- ]( R7 k

  35. . }& B+ [" E+ i9 H* v
  36. #include <mach/memory.h>! Q1 o' }2 [6 B8 F
  37. #include <mach/hardware.h>0 }/ v# X. q- J2 ]4 h4 x
  38. #include <mach/irqs.h>
    . O# v9 y4 Q0 C  |4 o. ~
  39. #include <asm/hardware/edma.h>9 @6 \4 }8 f7 `* o
  40. # Q8 c) I" f8 M& i/ f
  41. #undef EDMA3_DEBUG- W2 b' `, `" E0 Z. E5 T
  42. /*#define EDMA3_DEBUG*/; ^$ a% J0 A2 x* M; I

  43. $ u+ d! _" e5 |" x/ t- c
  44. #ifdef EDMA3_DEBUG
    " ]" z; `$ k  y* N6 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 P, v! W' ~; l- {) b4 V: q6 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ?5 l" Z* G  x% e. ]1 r( z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' `+ ]. Q# a+ \' R8 i$ j
  48. #else
    $ V; j0 Y- U+ o5 h4 x: k( K; ~, k+ g
  49. #define DMA_PRINTK( x... )6 D8 ]# `: O& y5 a1 G$ S1 v+ [3 @4 ?
  50. #define DMA_FN_IN
    + A' L6 O# d8 m4 g. c; x
  51. #define DMA_FN_OUT6 t+ k5 e9 M: ~5 X$ E: ?
  52. #endif* i( y" H, g9 d/ r( a! N; v2 K

  53. 7 \$ q: f3 T0 f" a  N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 \, u4 S) R" u- F
  55. #define STATIC_SHIFT                3- Z! R' ~% `0 Z  z5 L; n! w
  56. #define TCINTEN_SHIFT               20
    1 ]4 n: y* I. H$ ~3 c3 o" }2 {
  57. #define ITCINTEN_SHIFT              21" }& W0 ~2 M* ~: s: q
  58. #define TCCHEN_SHIFT                22
    9 C3 o' R- I, ?9 x7 i' c; r& I
  59. #define ITCCHEN_SHIFT               235 y* l6 ?" [7 J6 d' c, @' Z

  60. # o( ~$ q$ D* W( u
  61. static volatile int irqraised1 = 0;! x, S- M2 ^+ B* ?
  62. static volatile int irqraised2 = 0;5 x3 v0 g. a; E& S
  63. 9 Q- m/ K* A! K3 z4 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A0 |: y; o+ G# X$ I/ ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f* `$ t6 F& C+ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ i* V0 \( L( o. [# w- a

  67.   b0 Y9 P; U6 n( }$ K
  68. dma_addr_t dmaphyssrc1 = 0;
    + W1 t9 O& x) K  Q
  69. dma_addr_t dmaphyssrc2 = 0;
    9 b( N2 X, X5 G! s+ W8 W, O+ O
  70. dma_addr_t dmaphysdest1 = 0;9 F7 a- e# n3 a$ U* P
  71. dma_addr_t dmaphysdest2 = 0;
    - o. ~7 L, p( S% E

  72. $ R) `3 ^5 t) E; r& O
  73. char *dmabufsrc1 = NULL;
    9 B  w: S' G2 |! J+ Y
  74. char *dmabufsrc2 = NULL;
    0 ?% x/ ]- D6 M( S: A
  75. char *dmabufdest1 = NULL;
    4 B5 D. o% m' H1 h
  76. char *dmabufdest2 = NULL;. R% b3 u: Z9 Q* c: b

  77. & O' F* z* d6 L8 ]
  78. static int acnt = 512;
    ' e; B: C0 i$ t) B5 o8 G
  79. static int bcnt = 8;5 e- ?0 U0 N( b6 k) |4 S' ^
  80. static int ccnt = 8;9 m6 w" r( `8 e2 P8 n
  81. 9 z1 H% B) p  I  U, u4 `0 w
  82. module_param(acnt, int, S_IRUGO);2 B6 M7 Y" x. e) c6 B
  83. module_param(bcnt, int, S_IRUGO);
    - ]; e4 Y5 m; B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# c& m* W* i# m& w$ K7 a
( w7 Q: }4 s3 M- Q- w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~# c+ t: P" h) U2 f- Y, W5 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* b8 h8 H' B3 ^* H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \6 Y- O( _/ m. s: p. h5 b* ~$ |5 q1 s) c( G8 `: V

" t# D# T& o, f5 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 11:38 , Processed in 0.047796 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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