OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( }6 h& }, b& y7 e3 |
  1. [code]EDMA sample test application& Y- y( S* `# x3 ^; Y4 m7 g
  2. /*
    / c! E* N) ~6 T  {/ e
  3. * edma_test.c
    0 y5 U+ o1 K3 y$ a
  4. *
    0 X/ M$ _9 P( p2 ~
  5. * brief  EDMA3 Test Application2 ^' x0 t7 V6 J0 q2 P7 c+ k8 w
  6. *
    5 B6 v6 u9 {% i" e3 g1 @
  7. *   This file contains EDMA3 Test code.8 D/ P2 K0 o! p
  8. *9 Y+ M+ v, ?( E: w4 P1 U0 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' I% l( R. H& Y" M7 U5 r% |- `) [0 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% b$ L2 ?: R7 H, T$ c% p$ O2 ?) q
  11. *         TO CHANGE., s% K/ |( J9 K0 k
  12. *# E9 B6 ?1 P6 S, h1 W- @1 M! @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 g9 b! a$ T; k& Z( K% @( ?: n
  14. *
    * v+ c  x8 F: x! Y8 N3 S% F
  15. * This program is free software; you can redistribute it and/or
    ' s3 k' I& a, ~' n
  16. * modify it under the terms of the GNU General Public License as; ?. ~. v! p9 r) u+ D& I; W- C
  17. * published by the Free Software Foundation version 2.
    # F# S) r8 b, t! ^
  18. *4 X" Q' g. M, R. `6 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 Y! |4 c" Q* w% v( s. N  T. Y1 a- N
  20. * kind, whether express or implied; without even the implied warranty
    7 x( D& P" Q- ~8 _6 g$ ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( c* q$ S" v, X9 ~9 {
  22. * GNU General Public License for more details.
    9 [. i  [0 V- o* O+ \% X  n+ B
  23. */0 e8 B: p/ E" D3 W

  24. $ N$ L9 E' D0 `, T; u* \
  25. #include <linux/module.h>
    " H% {: }( `% t
  26. #include <linux/init.h>
    3 J  X4 x/ l0 N% a0 C$ J' H) w5 m
  27. #include <linux/errno.h>7 V9 H+ T+ Y2 l. }
  28. #include <linux/types.h>
    * ~$ v. s8 A9 y  _5 w$ v6 j: U( }
  29. #include <linux/interrupt.h>
    , ?6 T6 |1 K" u/ v4 Q& y5 Q# s, P
  30. #include <asm/io.h>/ z; X" f5 Q% T' U
  31. #include <linux/moduleparam.h>9 ~  ?4 ^/ }! Z4 ?
  32. #include <linux/sysctl.h>
    % y  ^. \$ y$ `  t* X* s
  33. #include <linux/mm.h>( [0 e% Y! t) }8 P: Y
  34. #include <linux/dma-mapping.h>, q# g! |! a2 P3 ~* I* _9 U

  35. . x4 J9 ]4 z: N8 r0 \* [- D" r3 `
  36. #include <mach/memory.h>( i0 f. K7 _- s
  37. #include <mach/hardware.h>
    7 U) K6 e2 I( j
  38. #include <mach/irqs.h>* z7 z7 ]+ a7 o! {, r) n
  39. #include <asm/hardware/edma.h>' ]7 v& w3 h  s- L

  40. - w* ]. L2 m! l% j7 D9 V! m+ E+ l
  41. #undef EDMA3_DEBUG% ^0 F' `& L. O1 }- |: R: _
  42. /*#define EDMA3_DEBUG*/8 C9 W+ w$ _% t! f( ]4 \
  43. ! T& P$ I1 h* g& e5 \: R' r3 U1 h
  44. #ifdef EDMA3_DEBUG) G) ?4 G# ~6 |0 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  u. H) h: M% j: o+ x! b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 c; J) C7 J$ k# R# Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 |: ^3 g7 r7 g% j( \: U
  48. #else) |7 h, q6 h% K3 z, @9 r& J
  49. #define DMA_PRINTK( x... )
    9 g5 }- r. n4 s  l# t" g  B
  50. #define DMA_FN_IN8 ?- l. U1 G# a0 C
  51. #define DMA_FN_OUT6 |+ J0 C4 ?1 d) ?1 `8 o2 Z! O( d
  52. #endif
    2 j# g/ a7 h% h) ~# }) `
  53. 5 O3 @- {) P' w% K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  [$ T) L& @1 o% b8 q
  55. #define STATIC_SHIFT                3
    9 Y" X; E" C. b: ?( G2 ]
  56. #define TCINTEN_SHIFT               20
    " y* G/ R- i3 k
  57. #define ITCINTEN_SHIFT              21* r; h: H% m& C. o. Q  z
  58. #define TCCHEN_SHIFT                223 U5 E: h1 R/ X
  59. #define ITCCHEN_SHIFT               23
    " B0 {" V1 n3 c8 }6 a- p, L0 r
  60. ( N9 p" c. o4 u/ `( ~
  61. static volatile int irqraised1 = 0;- Z: d/ S1 k, _6 E7 w. _& n, W
  62. static volatile int irqraised2 = 0;
    0 r( c. w% d  W1 M/ p% Y

  63. $ A: e- p* {8 _, ^4 _( Q( {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z% O# H& R# X8 O0 U, H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S1 i) v- L2 d9 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & e% x- j% q2 {/ N0 T. r  G
  67. $ q) M, c4 v7 \2 G3 p! z
  68. dma_addr_t dmaphyssrc1 = 0;% p; u# ?8 j8 a# z$ o" P' N1 ^7 G) x
  69. dma_addr_t dmaphyssrc2 = 0;
    8 A) ~# T4 x( _  H
  70. dma_addr_t dmaphysdest1 = 0;. J: E, d. q: D9 @/ B$ U3 U5 N
  71. dma_addr_t dmaphysdest2 = 0;# C: i, |: E6 N: K4 m" [

  72. # e$ {' T0 u" y9 y. w+ p3 X
  73. char *dmabufsrc1 = NULL;
    , w4 U9 v& l& h. U
  74. char *dmabufsrc2 = NULL;8 Q0 L5 F# D1 y5 G9 g6 U. m
  75. char *dmabufdest1 = NULL;
    6 L$ b0 k: ~7 H0 t
  76. char *dmabufdest2 = NULL;! G( ]/ ^* `( o# `% e* _
  77. % Q. |$ g% F7 F$ L7 M3 E9 k: P5 M; h
  78. static int acnt = 512;, j3 l9 |, ]/ A  R
  79. static int bcnt = 8;
    1 F; ]. y3 x4 u6 i& _& Q
  80. static int ccnt = 8;& O, }' u. l1 m, A

  81. + F* w8 F- O, K4 f6 L/ F
  82. module_param(acnt, int, S_IRUGO);
    + b# L3 `. Z6 L9 B: v- J
  83. module_param(bcnt, int, S_IRUGO);2 g" R! W9 r1 q5 ?: D+ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" H! a" q; Q; w4 |5 N, u" c- K% ~  q2 [

- {! t+ p, t: G/ ]( d5 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  t6 O1 k3 P% ]3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' L, y& X. ~& S  @+ ?% d9 G/ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ s% ]+ P0 Z/ j  ?4 Q2 x* \2 C
, z4 r+ M  ^, t. N; \% m7 F
9 q& Y' V# k+ N( X0 }1 |, ]: `" A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-4 18:21 , Processed in 0.037126 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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