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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 t' B. `! |: a; q. i  e
  1. [code]EDMA sample test application3 ~8 A& z# x" g. |" B: f
  2. /*" X8 Z+ @1 }7 N, G1 F) X& ]
  3. * edma_test.c5 I* {5 k; Y1 f+ D4 P8 o% A) Y
  4. *% g9 O+ Y4 `& ?% Q: k+ W) u" O7 X
  5. * brief  EDMA3 Test Application
    / ~6 H) T+ Q% g7 j9 W; h7 ?
  6. *5 u5 I3 k5 t9 F1 m/ w6 o
  7. *   This file contains EDMA3 Test code.
    2 Z# ?% }$ E, I. X
  8. *
    3 q3 Y: ^, D( \8 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * K2 U' M2 R) U% q$ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : U% u7 W, y  p
  11. *         TO CHANGE.
    : z* U0 g# N6 n* l# F; [
  12. *
    , }! [* K2 X4 K# I, S8 @- x1 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U* G$ {( J! l: h0 M
  14. *
    # t# [% A! t7 ^1 p  x4 l
  15. * This program is free software; you can redistribute it and/or
    ; v8 R  a6 `  D" Q/ a/ U
  16. * modify it under the terms of the GNU General Public License as: ~* Z% U9 G% V8 [  F9 m) D0 w
  17. * published by the Free Software Foundation version 2.7 W# N; k4 q8 d4 W% H
  18. *! W1 J' d6 a# Z1 O0 l3 l& h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 ]. B. g& ^& U/ p" M' R( q
  20. * kind, whether express or implied; without even the implied warranty7 O1 n! k3 T0 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 M. L* ?4 H) Q/ M% w4 [& C
  22. * GNU General Public License for more details.2 u& H" r, Y$ V% {
  23. */6 }3 Y2 e# a# i  e

  24. : \# H' A1 E3 n& A4 R
  25. #include <linux/module.h>
      u5 q" S; r/ e" Y
  26. #include <linux/init.h>- |# T" w# f5 F! u
  27. #include <linux/errno.h># f2 h- {' c/ a2 v. W
  28. #include <linux/types.h>; q5 T: }4 O  d" D$ I
  29. #include <linux/interrupt.h>
    1 u1 l) n; d! y& g7 [2 X* Y
  30. #include <asm/io.h>
    % a' }$ t& l8 }# y- ^6 \
  31. #include <linux/moduleparam.h>- H, a9 m2 _3 ?( _( C/ ^
  32. #include <linux/sysctl.h>) K. @* B9 k( T( Z5 |$ m
  33. #include <linux/mm.h>
    1 P* q8 ?+ f5 J% n
  34. #include <linux/dma-mapping.h>! A1 D  U  N; w  }. W; d  m

  35. 0 x& Y' ~: S' p8 y5 p% ]2 h
  36. #include <mach/memory.h>
    ; J/ d( c4 L: [0 X
  37. #include <mach/hardware.h>- v6 L3 S# |/ J' `6 I
  38. #include <mach/irqs.h>
    " \4 I; V& [  ^" k2 M) }4 e$ r
  39. #include <asm/hardware/edma.h>- o6 b& B5 I" c: J! G$ r( N9 O

  40. . B% f; i4 M4 T& b
  41. #undef EDMA3_DEBUG
    3 O5 E0 W3 o6 s* N& T6 F
  42. /*#define EDMA3_DEBUG*/. l( [$ W8 W2 r# I5 o& B6 \
  43. . q+ p: p  v# f9 C4 Q9 }
  44. #ifdef EDMA3_DEBUG1 d9 _& Z8 j3 ]% l9 x* c! ~) E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 m5 U% N4 S! o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - s9 w* ~* c% }& O7 r5 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      k* J) S1 ?' L
  48. #else% r5 T- @8 R8 x8 G* W
  49. #define DMA_PRINTK( x... )7 E& M/ a2 ?" g# X) n% K
  50. #define DMA_FN_IN
    * y3 z1 N1 i: z8 D
  51. #define DMA_FN_OUT
    * ~: T! ^1 i/ d
  52. #endif
    ' O& Q9 o7 ]$ I" e2 x* ?( f0 B

  53. ' ~6 B" X( k# h' ?$ Y9 U# D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 U; o+ _) [( |
  55. #define STATIC_SHIFT                3/ ]1 ]( {* x( {. g, E
  56. #define TCINTEN_SHIFT               20; x$ y! |' y5 D
  57. #define ITCINTEN_SHIFT              215 S! M# [: ?5 ?) S) |3 X& U+ x
  58. #define TCCHEN_SHIFT                22- ?0 P. D% Z+ ]2 }
  59. #define ITCCHEN_SHIFT               23* b: l. M6 I" V+ k0 ^& d1 [
  60. 7 @1 K3 y; p" V% {9 q) b
  61. static volatile int irqraised1 = 0;- j- T% X" H% F( N! [3 s: s4 P
  62. static volatile int irqraised2 = 0;( K! @& q7 d8 O: U
  63.   f# f% o- ~5 f3 z; p) |$ W3 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `3 W  \- r) J% |' w' [  L4 m. S( k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y0 S; r7 T" t0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G4 y" I& `( W

  67. 1 D2 B2 a/ k/ f* \  J
  68. dma_addr_t dmaphyssrc1 = 0;6 G8 m: C4 j% r+ S5 K6 D8 I
  69. dma_addr_t dmaphyssrc2 = 0;# N* b  o/ f% _3 r
  70. dma_addr_t dmaphysdest1 = 0;0 m. d( u4 I; E$ @  i/ w) h
  71. dma_addr_t dmaphysdest2 = 0;
    1 O& J# X  B1 V, B9 t( v% H
  72. & m+ ^7 d: _! d2 _
  73. char *dmabufsrc1 = NULL;
    6 G( a; g' w* M# v
  74. char *dmabufsrc2 = NULL;
    6 F6 K+ t5 |4 r) e3 H3 E
  75. char *dmabufdest1 = NULL;
    4 u( f2 n8 ]9 C( `" l
  76. char *dmabufdest2 = NULL;' S' {9 {+ z% h$ r
  77. ) u5 a$ t# T- y" f
  78. static int acnt = 512;
    , H, \  t* w7 Y+ v. I# O+ j! C. U/ w
  79. static int bcnt = 8;+ l, F# s0 \. q. T( F7 ^# E9 |9 M
  80. static int ccnt = 8;
    8 i; |% b3 d! o$ M

  81. 3 r7 R, h! L8 k
  82. module_param(acnt, int, S_IRUGO);7 s; G) z( \5 b1 k  r
  83. module_param(bcnt, int, S_IRUGO);8 w- I& @1 ^1 K' T! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 r' X/ I/ n3 f# a9 m' j  J5 @8 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* f, ]# u; B3 c+ R/ x6 G8 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, E( O& x* w2 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: w# o. o8 a* I
' O1 A: j: F; Y6 e1 h9 d

) @$ U: t. Z) H% F- ^. x5 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 11:02 , Processed in 0.047318 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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