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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( [* X6 I+ w! j/ u9 n& a9 P4 b
  1. [code]EDMA sample test application3 h( \7 Q4 A8 H3 x
  2. /*
      R7 f% i/ y0 E  s6 U! h
  3. * edma_test.c; b( w1 c, Z. `
  4. *
      @$ e, F6 D5 D% q
  5. * brief  EDMA3 Test Application* P) a# v  L8 u: f1 u# R* M4 `
  6. *
      P& u0 \8 o5 A8 p% ~: I7 W1 D
  7. *   This file contains EDMA3 Test code.5 H2 F; y# t! \* [8 T  J
  8. *3 v$ I- c: B6 x7 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ c  d& z# Y9 {5 k1 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Y$ ~- Z2 I& L. q$ Y$ S3 E
  11. *         TO CHANGE.
    ; }2 n9 A) m- s/ u; S4 q
  12. *7 }: p# W( q4 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " V! x9 h/ S' ?5 g' C- m, B( ]
  14. *% i$ p9 z# q1 R6 q8 b
  15. * This program is free software; you can redistribute it and/or8 w. P! `4 ?1 w, [( R9 d' o
  16. * modify it under the terms of the GNU General Public License as
    6 m* c( ^% M4 v# p# f
  17. * published by the Free Software Foundation version 2." g( h* _. e; I  l% ]+ h; Y
  18. *" p# H  v% m. j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ w/ l/ a' O5 H! k* |+ }
  20. * kind, whether express or implied; without even the implied warranty
    ! M8 d& F$ w  w: ?. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 }# ~' P* v, P6 M3 {" T! _
  22. * GNU General Public License for more details.
    $ d! k- ?8 _* d: w
  23. */
    3 e, P) E3 d. I$ N

  24. & W: k4 P! E& O$ U7 {* h6 N
  25. #include <linux/module.h>$ q- h3 e* {0 m: p) w9 {/ {
  26. #include <linux/init.h>
    ' Y% [! W# v- A3 ~9 p
  27. #include <linux/errno.h>
    9 b( |, E/ g2 W& Y
  28. #include <linux/types.h>
      R7 g- h. Q0 a. n/ N' \
  29. #include <linux/interrupt.h>
    % b% T( X* G: {, d& `6 l" D
  30. #include <asm/io.h>& d, x/ ^! V4 d" I
  31. #include <linux/moduleparam.h>
    4 ?7 |1 U/ a0 D$ H1 a8 `
  32. #include <linux/sysctl.h>
    + y! ]& c6 B+ L5 F
  33. #include <linux/mm.h>& r; _& c+ L! `6 |) p/ ~& L  N
  34. #include <linux/dma-mapping.h>' G. M4 t' Q2 j9 Q3 _& S

  35. ; W" b  d; n: N& ^
  36. #include <mach/memory.h>2 d3 {  z, m/ ]! u& o$ D; ^
  37. #include <mach/hardware.h>* X6 C" B% o3 j" R
  38. #include <mach/irqs.h>
    * ]& \0 N  c: o# @/ L( j. h
  39. #include <asm/hardware/edma.h>
    + q* f$ f( F# u6 v$ Y/ c5 X
  40. - z  \6 J2 C) O5 C; \7 j/ r
  41. #undef EDMA3_DEBUG0 {- G* {2 B4 A% l
  42. /*#define EDMA3_DEBUG*/
    ; D% M2 ?6 n' t9 {$ L6 Z
  43. " Y. |, S7 M; A3 V
  44. #ifdef EDMA3_DEBUG- \7 B& F4 ]  j4 J; J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ]' S0 G; K, `9 O/ I0 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  E/ m3 H; @5 b& z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & `0 x5 I8 S9 ]. T
  48. #else
    " \. H; U: K8 a5 [$ Z3 o# ~* U
  49. #define DMA_PRINTK( x... )3 ^3 P" L: C  Z( ~  g8 U  {
  50. #define DMA_FN_IN
    0 f2 d+ f3 r  C% d/ g" V- o' L
  51. #define DMA_FN_OUT
    - w3 {) Y: `9 f, Y  ?. J) Z
  52. #endif# v8 \4 W! U" `7 G! Z- Y  M; N' K8 S4 S
  53. 1 ~2 C( ~3 v: w: W$ o. Q" Y5 w1 ~; B: d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* F" d* q: g' d  d6 e! w% `8 X
  55. #define STATIC_SHIFT                3! M5 H) a0 `( E8 d/ T
  56. #define TCINTEN_SHIFT               20
    ; T. S' G% }5 @
  57. #define ITCINTEN_SHIFT              21
    2 |. ]; J) u. |- x: p- m
  58. #define TCCHEN_SHIFT                220 z9 Z+ K6 B7 x8 U( |% w
  59. #define ITCCHEN_SHIFT               23
    4 R( y1 x: r' b6 o4 q( n
  60. 4 b) ^" g' V$ r* U& E
  61. static volatile int irqraised1 = 0;
    7 Y% l  d7 Y* Q  e2 Q
  62. static volatile int irqraised2 = 0;
    . l/ u. ?. i& a2 s( G3 r
  63. 4 {+ E) H" K2 y- _8 w1 F- m" L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 n% I5 J* G2 X* J1 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N* R0 Z& X/ P9 R# @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x- c6 W- n& |4 {( d. f8 G1 _

  67. ' G1 z( S( T( N% d
  68. dma_addr_t dmaphyssrc1 = 0;. t- ~7 u1 A! X8 f
  69. dma_addr_t dmaphyssrc2 = 0;
    9 u* \) N4 a. ^  b( ]% j" ?
  70. dma_addr_t dmaphysdest1 = 0;
    ( `+ \% j% C  Z
  71. dma_addr_t dmaphysdest2 = 0;7 u& L+ h; S' v( W
  72. 3 R/ l* {; z- ^5 e2 h1 H2 L& U6 m
  73. char *dmabufsrc1 = NULL;$ i) M% A1 ~0 M. }5 P, j; s
  74. char *dmabufsrc2 = NULL;
    4 p! d0 n$ X+ T  X( u3 @; L
  75. char *dmabufdest1 = NULL;# `! g8 G1 ]/ e
  76. char *dmabufdest2 = NULL;
    ' {7 k* |9 O: Z% j2 C
  77. 9 W# Q9 X# t, F
  78. static int acnt = 512;8 }% M& f: z. ]' s
  79. static int bcnt = 8;6 e) j) Y" o" j! m! z. D, _6 G
  80. static int ccnt = 8;
      a- F3 d4 b6 ^6 i
  81. , ]1 {5 r9 q, [0 G0 K7 r
  82. module_param(acnt, int, S_IRUGO);" v2 d( ]" U4 y; ~9 ]$ ]4 Z
  83. module_param(bcnt, int, S_IRUGO);0 ~6 }$ S5 G" l0 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ }' N. o2 p3 I  w# w0 f% x% _- ]
, L2 k! t+ t6 r/ b/ y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \7 ^* ?+ i( S# _! V& ~/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) }% o3 }% O/ i/ S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m/ o9 q0 y& `3 t9 N/ F0 g# d

" ^: H; {0 F; T( q# s' ^, I$ @
7 L* J) j+ e" F& [7 C. S9 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 02:30 , Processed in 0.044369 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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