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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ~, G+ `! B" a# s, ]
  1. [code]EDMA sample test application  f- [7 V5 k' h
  2. /*
    " S' K5 j7 ^6 o8 O. n1 N2 v; U$ w
  3. * edma_test.c
    , a  [2 f9 ?1 R3 l
  4. *  B- s' y6 U/ r( n7 |  V! p5 _
  5. * brief  EDMA3 Test Application+ g  r: F1 J% b1 E. P% C+ U+ N/ C& _4 ~
  6. *: r% o8 V5 Q5 F, W( H0 e6 y
  7. *   This file contains EDMA3 Test code.0 I; g: e! h  B0 q
  8. *# P1 u, G6 s& Q* d0 t3 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 ~) z9 p) R% K+ m/ T! X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 f6 U- I) _5 p+ }
  11. *         TO CHANGE.
    6 c: d* A5 i, X  G4 A+ K
  12. *$ z. R; B  q2 ?$ a- \  D5 l+ a: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , k: S3 B( M, d1 l; w, a
  14. *. ~* C6 M) t5 r( m* d' W
  15. * This program is free software; you can redistribute it and/or& n2 V$ i6 c) `& ~+ }- g
  16. * modify it under the terms of the GNU General Public License as8 `) \, o% v' |
  17. * published by the Free Software Foundation version 2.
    ! y/ r& {2 s) E5 l0 O- S% Z0 G
  18. *5 N4 _! ^" F! c; z% l+ v6 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ]5 c& b# i5 N7 l: a
  20. * kind, whether express or implied; without even the implied warranty% J) `" m/ W4 J5 ?2 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 F8 h* g9 s; D/ G
  22. * GNU General Public License for more details.
    ( f0 l% C0 @( e6 E8 B% e7 G
  23. */
    # `5 F( d6 c5 M
  24. 5 s3 E/ w  y' u, K5 A$ c
  25. #include <linux/module.h>) m- V, t. O5 G; @4 t) F
  26. #include <linux/init.h>
    + l- D9 w: Q2 l, x
  27. #include <linux/errno.h>
    2 I7 W$ e9 Q( }! L6 V- E, [
  28. #include <linux/types.h>$ t3 i7 Q; }! d7 u7 K( I  U
  29. #include <linux/interrupt.h>
    0 B1 z% G' P! C' y( C
  30. #include <asm/io.h>
    # D6 P# S9 ?3 _0 [5 P0 k, G
  31. #include <linux/moduleparam.h>
    9 |% @& m& h: R2 X# x
  32. #include <linux/sysctl.h>  }% z3 c% ]) [
  33. #include <linux/mm.h>3 W9 {/ u9 r% v2 [3 ?- h
  34. #include <linux/dma-mapping.h>
      C: ~# v1 s2 D6 b  F. ?7 e
  35. 0 y- q3 H- \( g- N# v4 D3 J
  36. #include <mach/memory.h>
    3 a9 L! a7 X" n
  37. #include <mach/hardware.h>
    " Q/ U: z: A- A, j, T* c: S
  38. #include <mach/irqs.h>, o  _2 f9 h  O) |* Y
  39. #include <asm/hardware/edma.h>5 D5 i, y, i% ^$ d9 k
  40. % i3 Z" G5 j  m% }; d6 V7 h* g
  41. #undef EDMA3_DEBUG9 n. [: X1 N  m( q
  42. /*#define EDMA3_DEBUG*/8 U) ]& L( G6 l$ |$ H
  43. 0 k6 D' K# X; C
  44. #ifdef EDMA3_DEBUG) `: I$ m. g% ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F# D: i9 i( _1 A; v( {( Z& L4 u1 I7 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , y9 T  _( {1 j9 Q( \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( n/ T) n, Z% U/ D
  48. #else
    ) U5 x: ?) N# x7 f; [2 D7 i; `
  49. #define DMA_PRINTK( x... )
    & _  N: K- l6 @4 A! z+ C2 f: j
  50. #define DMA_FN_IN
    + k/ \; Y6 ~" r& S
  51. #define DMA_FN_OUT& x4 ?8 {8 R$ I9 @
  52. #endif
    , {7 Q: @6 F8 L

  53. 6 h9 ~; b& m- U, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ W% V1 T0 S* ^& F5 h
  55. #define STATIC_SHIFT                3
    ( E& M" W3 T- _) [# n2 U
  56. #define TCINTEN_SHIFT               20
    2 {) w/ N2 O7 E# M
  57. #define ITCINTEN_SHIFT              21
    . Q  n. `5 j* y/ T
  58. #define TCCHEN_SHIFT                224 k% w4 _4 }8 P6 x; H; ?
  59. #define ITCCHEN_SHIFT               23
    1 T, E7 Z+ A: R7 u6 v$ G9 f4 ^

  60. ! ^9 @" |$ i  ]: x4 ~
  61. static volatile int irqraised1 = 0;
    $ {3 ]2 e& D7 M2 Y- F2 Y4 ^7 E$ V- a
  62. static volatile int irqraised2 = 0;
    $ n9 \8 \3 [6 {- r

  63. - F, M! S* h' N. o* I5 \7 E9 J8 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H/ }3 J5 M; r: R+ a* b% i6 A# f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % G9 C+ p& h% p1 s5 c- ^* |% K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N( f9 s0 z" g( h; d
  67. * W( v  \! m6 {6 N, z/ {
  68. dma_addr_t dmaphyssrc1 = 0;
    9 b) S7 A3 X: H# J
  69. dma_addr_t dmaphyssrc2 = 0;
    6 A& Z; t. i4 H2 n0 f: R
  70. dma_addr_t dmaphysdest1 = 0;
    $ A6 ~* K6 p$ S9 k, k. y  R) K' E
  71. dma_addr_t dmaphysdest2 = 0;  ?$ @  E3 E4 }) E& }! ?6 D5 Z
  72. # H+ x7 l/ J* d/ d7 \8 j
  73. char *dmabufsrc1 = NULL;
    ) t( ^6 t4 `2 A; n# U. s) m% H, i
  74. char *dmabufsrc2 = NULL;& Z  q" q# g, @1 m$ n
  75. char *dmabufdest1 = NULL;1 p  C9 ~6 k9 s# g' D
  76. char *dmabufdest2 = NULL;
      |' B. `* O/ P# a
  77. 2 h* d7 {7 i4 k: C6 d
  78. static int acnt = 512;$ |% q, t+ I( t+ d7 ]3 S
  79. static int bcnt = 8;
    $ }: z$ ?! W4 V' j, l
  80. static int ccnt = 8;
      z- P" h$ L& e8 m& D7 T6 y
  81. ; @- ?& |% l' D! A5 O$ Y$ Z) c; `6 k
  82. module_param(acnt, int, S_IRUGO);
    6 d, X% R+ G0 a7 ~# y! x
  83. module_param(bcnt, int, S_IRUGO);
      h, w! ]+ {* i3 H$ w  |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 x- z$ N1 b% P) c9 r' I# i1 Q
1 R. D2 D/ U  ]0 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  D7 S+ u, ^6 Q9 c2 u; e4 U. K" Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" a" v5 O% _8 M  y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! U7 W3 E6 W% `$ P3 N

; ^6 }+ ^: U* P/ i% y$ W
! I9 |6 n" G5 K! E5 g0 |* B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-27 11:34 , Processed in 0.044752 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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