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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 x) i0 V# b: X  k
  1. [code]EDMA sample test application  d" C! ?2 v9 o0 o) t8 Q7 ]& J' q
  2. /*
    " T' u% j, h' l, P3 Y7 n
  3. * edma_test.c
    3 E/ E- T3 `9 m; Y7 _% m
  4. *
    # W4 V, I8 s& V4 |/ g/ i
  5. * brief  EDMA3 Test Application4 V6 B4 a: [( O  ~' t
  6. *
    # k* n% F- _! e$ A5 x
  7. *   This file contains EDMA3 Test code.
    ( H2 T, z) A% R: E9 N. N
  8. *7 G7 u  w" T+ c2 f* D5 G* w$ k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* p* c+ N' |' M' O0 U+ u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 P0 Q; Z* j+ ~6 g5 f  T
  11. *         TO CHANGE.
    ' @; O' a  |& Z4 R2 [
  12. *# R0 o' P& f. z7 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C; B# H* V, b3 [/ v' Y
  14. *
    3 N4 ~/ R, E3 R7 C3 L  R
  15. * This program is free software; you can redistribute it and/or6 _% u+ {8 ^' e( ^1 r9 X
  16. * modify it under the terms of the GNU General Public License as
    " B* p8 A$ i) p/ N2 ?/ S) K/ ~( J6 j
  17. * published by the Free Software Foundation version 2.0 m! E6 U8 W: F" w, C
  18. *, E" r& Q  L* X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " w5 K! T$ h( ?6 j2 T# K1 o' U* Y
  20. * kind, whether express or implied; without even the implied warranty0 m" K- s% ~9 s9 U: z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      b( r$ f9 s. @5 D  P5 r0 m+ z
  22. * GNU General Public License for more details.
    " l& p6 f% }$ |. y2 E# P0 Q5 ?, l# {' {
  23. */
    % I! Y3 r, h+ r. w  V/ s$ S
  24. 0 H5 u. H- W. k6 P) C
  25. #include <linux/module.h>
    ( F. r0 S  P: U" o( P+ c1 V
  26. #include <linux/init.h>
    2 b' X4 k/ _! v" ^2 g6 k, K
  27. #include <linux/errno.h>  \4 b' d5 i- ~( ]
  28. #include <linux/types.h>
    + I" r2 T3 F4 ^3 i  w2 E
  29. #include <linux/interrupt.h>
      G: m' ?1 [5 t
  30. #include <asm/io.h>
    & Z3 \$ Q0 E% l& M) h; C1 q6 k
  31. #include <linux/moduleparam.h>% ^; S; ]1 l5 c8 U7 K# y
  32. #include <linux/sysctl.h>, b/ n- U8 y7 w& k# C; L& [/ `
  33. #include <linux/mm.h>
    % |9 ?7 b# @. T7 i1 X
  34. #include <linux/dma-mapping.h>0 \" F' Z6 N# a( O2 [" ^

  35. ( Q; p) T) n8 G. b* t# N  F1 G
  36. #include <mach/memory.h>  ?. F" w  M6 B
  37. #include <mach/hardware.h>3 U% c0 R2 F4 z# i$ J: L8 f' I
  38. #include <mach/irqs.h>- a; E3 y/ t! c! O
  39. #include <asm/hardware/edma.h>- o1 L/ W' Z. D; X) K
  40. 6 [3 |  \, w5 V2 u! P
  41. #undef EDMA3_DEBUG# G! q8 U2 l! v* i
  42. /*#define EDMA3_DEBUG*/
    # C+ n" Y! ]% J, K2 p

  43. ' N- _: e; S6 U+ b9 b% m6 i1 C; i1 r
  44. #ifdef EDMA3_DEBUG
    0 L; M& \8 L4 _" W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ^, B6 Y! M+ i: a: o2 _3 V$ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 y. v' R; b6 G8 Y0 x4 `$ Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + i: |$ s; ]) F1 r. ~, ^
  48. #else% Q% R! y3 F" s4 z  l8 v
  49. #define DMA_PRINTK( x... ); E1 b0 y8 R5 S- K" A
  50. #define DMA_FN_IN! P! m7 ]% X& c) ]/ n- V# m2 z
  51. #define DMA_FN_OUT
    7 G% r# i3 j' L. c; ~2 Z
  52. #endif
    # a  \$ k/ g2 z/ m+ B4 F
  53. , I1 K1 d# n0 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 A* K& U' i; I& j6 d. b* V3 E' L
  55. #define STATIC_SHIFT                35 h4 n7 Z) U0 _4 g1 s
  56. #define TCINTEN_SHIFT               205 _5 x- y1 e0 |% n$ Q% K$ w, z( Q
  57. #define ITCINTEN_SHIFT              21; a4 i" c0 J$ s0 x) q1 ?
  58. #define TCCHEN_SHIFT                22
    " }6 @, ?3 ~! ?* ]$ Z4 `  Z
  59. #define ITCCHEN_SHIFT               23) p5 W6 y3 V) ?+ h$ F% ^% K
  60. + U- m  E( q- D. n) }/ Y$ m  m$ D
  61. static volatile int irqraised1 = 0;  B" \; H+ v, h
  62. static volatile int irqraised2 = 0;
    $ s6 p! V0 k1 q5 I% U! G' Q. O
  63. % H$ U+ `1 v- L2 {, M8 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |& F- x! s5 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?- J9 r! S0 p+ g7 h( j8 H) O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 |! m1 W. G1 G! S2 a+ a2 Q& s/ E
  67. ; ^+ k; n' o6 s7 b
  68. dma_addr_t dmaphyssrc1 = 0;
    1 _7 u8 ^3 }; M+ ^0 v9 w0 E
  69. dma_addr_t dmaphyssrc2 = 0;
    8 G7 A* x1 s4 d  ^4 P( j
  70. dma_addr_t dmaphysdest1 = 0;
    & z/ v6 P4 I4 Q/ w
  71. dma_addr_t dmaphysdest2 = 0;/ O* y9 J, I' B* X. }7 W
  72. , Z' O. X) G6 U; h
  73. char *dmabufsrc1 = NULL;8 r. E3 {. @; d. @2 Q$ L
  74. char *dmabufsrc2 = NULL;
    , H0 E* c  n1 q% M  b( P4 _9 `
  75. char *dmabufdest1 = NULL;
    ! |. X' {# a2 T" J( H& f' ?
  76. char *dmabufdest2 = NULL;
    1 Y1 }- v4 y, |

  77. . d% K  |! C2 O& ~" T5 ^3 u/ q
  78. static int acnt = 512;
    4 P. L8 O6 E" q# L* P* m
  79. static int bcnt = 8;; W: ?6 ^& G/ a; x9 Q; Q
  80. static int ccnt = 8;$ w: M0 D& I0 x0 }# Z+ D: e4 f8 J7 P
  81. ' D9 \: U3 v! [- D
  82. module_param(acnt, int, S_IRUGO);+ b$ m$ c. O( }
  83. module_param(bcnt, int, S_IRUGO);
    0 \, ~. Q- s3 Z& b& O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# z- A8 Q2 B$ \7 k( Z

" R$ k# W: E/ f  {9 r: d6 A' |) U# ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) N" O/ j$ ~; h% A: y9 }3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I* T- H% j/ g+ o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ~3 K+ C" u" G5 V# u7 H( q8 x8 l. A2 E1 B+ g8 ^6 G
1 O" ]( F: h- O) z. L1 @6 Z) `4 u- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 00:36 , Processed in 0.040058 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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