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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . i" _5 f# b! B/ l+ ?
  1. [code]EDMA sample test application& u, O9 X7 l+ x: z: E  t0 F/ u
  2. /*
    , I# {) V  Q+ R7 u. M
  3. * edma_test.c
    ' y' A& a! A/ K
  4. *
    $ j% p: E6 l9 X  K; {$ q6 Y# ^& p. Y
  5. * brief  EDMA3 Test Application
    9 \0 P9 ^: X+ n: B( l2 s, u5 F
  6. *
    7 @+ B5 C' a2 U0 q% k6 ~$ j
  7. *   This file contains EDMA3 Test code.
    * o! b6 p$ s* y4 U. w
  8. *
    $ I$ L5 E' @* o1 J; W5 w" h' d) q3 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 z/ ?$ i: _% y  r! S, k$ r  B* p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 \: o, p5 p8 u( A3 x+ O
  11. *         TO CHANGE., U4 \) n/ ]# W& u
  12. *6 R/ A" ?( {( |. S( c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 k! O. |: V) e( c) [
  14. *7 w  `5 j! G- J8 w
  15. * This program is free software; you can redistribute it and/or" y* W# W9 {) j& W: S5 u
  16. * modify it under the terms of the GNU General Public License as
    5 D: }7 v: r; X2 Y) W# Y2 H0 U  g
  17. * published by the Free Software Foundation version 2.9 a% q' i- {: H  @  s
  18. *
    + ?# V( l. S' e' p: L$ u8 a8 ~3 R5 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 D1 G# w8 f+ w9 g/ R
  20. * kind, whether express or implied; without even the implied warranty+ y5 j* q/ |% P5 q6 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 h2 u7 W! f5 k4 @% h
  22. * GNU General Public License for more details.
    " A+ h1 W$ W* \" j6 S6 w! d5 a% {
  23. */& H" P! j" v+ a1 w: L9 ^- b  [

  24. 4 M$ s: @4 {% ~# D3 F" \" X
  25. #include <linux/module.h>; A+ U8 d+ F! h+ K& D+ A
  26. #include <linux/init.h>
    & q6 A8 x( E% N7 N" k, B# v
  27. #include <linux/errno.h>) P$ [6 y' O) B& \+ M+ d' v7 [) J/ G
  28. #include <linux/types.h>
    ! F1 ?7 O5 U7 w- P7 C5 r: P2 [
  29. #include <linux/interrupt.h># t9 |- O! D- h0 Q" G
  30. #include <asm/io.h>
    - X  O# J$ c" r# N- v, ]5 {  N
  31. #include <linux/moduleparam.h>
    1 e3 s8 {7 [3 f' t% }
  32. #include <linux/sysctl.h>9 l3 W9 T7 S! M0 {4 \7 c
  33. #include <linux/mm.h>
    $ `9 ^4 R+ |8 V( K1 Y
  34. #include <linux/dma-mapping.h>) m/ ]; b+ c) b8 h) o, f

  35. ; }9 d) T7 }, p
  36. #include <mach/memory.h>  L0 U. T% v: W1 U( n0 Y
  37. #include <mach/hardware.h>8 g5 \4 {% e( G# U) u- [9 u  D
  38. #include <mach/irqs.h>
    % j7 n, O, p6 s2 z
  39. #include <asm/hardware/edma.h>
    0 t, s% h$ \& ^/ {6 F

  40. 1 m3 ?3 q; u* j) a$ d
  41. #undef EDMA3_DEBUG2 J9 c( P- U3 J% w
  42. /*#define EDMA3_DEBUG*/8 G4 `4 `* m4 c3 Q$ W1 F- u- ]

  43. ) r! y" H2 {% \7 N# G5 b, `, x
  44. #ifdef EDMA3_DEBUG
    ( H$ K! T5 ]: v0 Q$ ]( ~1 Z" z8 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 T$ e  r' ^% M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * U( y3 _* g, d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 _1 q/ E4 z% V7 S6 e" ?8 ^  r: M
  48. #else
    + [& S4 |* w1 P" ~9 G( M
  49. #define DMA_PRINTK( x... )0 B, e+ P0 \0 M) ?6 G% }
  50. #define DMA_FN_IN% ?# z# {  j/ D+ j6 G
  51. #define DMA_FN_OUT' |, ~- Z4 ?; ]0 K
  52. #endif0 P7 q& ~6 O2 c1 t( J! s
  53. / j0 F0 E# \  Z  i- j4 d6 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% p7 a: q- L  {1 q( R
  55. #define STATIC_SHIFT                3+ f' N# U4 p+ F9 y
  56. #define TCINTEN_SHIFT               20
    ; ?) x, b* V- c* U/ |6 {
  57. #define ITCINTEN_SHIFT              21
      W3 e" J3 ^- i/ Z# n0 w% K6 ~5 L
  58. #define TCCHEN_SHIFT                22( B' c1 \+ }- J
  59. #define ITCCHEN_SHIFT               23. {( p) T3 k% o* U# ?' s  i1 T

  60. 3 `, ~' V3 ^2 [" N! G; H
  61. static volatile int irqraised1 = 0;  _7 D; t8 P% z( A
  62. static volatile int irqraised2 = 0;! q+ Q9 i+ E) g( i, @% E, d& U

  63. 3 C. Y# O4 L5 m: p; s3 J4 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G7 x& z- y( W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U& D* @: G( w1 h1 A+ C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , D: F( N  x! h/ b% O
  67. * U) j6 K* m. O" L0 `: Y9 e1 a) v1 s4 N
  68. dma_addr_t dmaphyssrc1 = 0;
    . {+ q+ d! K; H9 P1 q. V$ o4 \% ?
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C( s7 x% h  _8 \) z: E; B8 ?) |
  70. dma_addr_t dmaphysdest1 = 0;/ H4 T  Z& u& g3 `, d
  71. dma_addr_t dmaphysdest2 = 0;
    - q- r+ [5 X2 o" o
  72. ; f  w+ a& x, x' y6 U' F
  73. char *dmabufsrc1 = NULL;) t6 h+ i) }! I5 s5 @0 P1 b
  74. char *dmabufsrc2 = NULL;
    " M  Y$ }9 E4 \6 [& C, {
  75. char *dmabufdest1 = NULL;
    ( Y5 ^+ @- Y; c3 O# `  O  v' B; Z4 v
  76. char *dmabufdest2 = NULL;
    + _4 f. S1 u8 Q3 e9 }+ w
  77. 4 ~5 C/ ?7 T, t% _* `  v7 f
  78. static int acnt = 512;* R. I# ]1 r. u4 |( R
  79. static int bcnt = 8;/ T  q* _9 y# v4 O/ ]0 r
  80. static int ccnt = 8;
    , U# V6 l2 ?/ v4 B1 E& S
  81. / B) y0 E; J" B7 h: W( m
  82. module_param(acnt, int, S_IRUGO);
    1 N5 W: w8 @# R
  83. module_param(bcnt, int, S_IRUGO);1 Z, v7 g$ E9 Z* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) y; A% Z9 L# c) @) c
( p5 h8 n! G' Y. d- J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- l% s- a1 S; j8 B. n9 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [. b% U) ?# }3 F9 C. @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X  W) o6 m7 s) [0 N7 z0 K2 S$ E/ l
2 i+ p9 c" @9 B# N" T. Q" U/ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 09:26 , Processed in 0.040092 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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