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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 A* }4 T) R* a6 v8 h
  1. [code]EDMA sample test application- w5 b& ^' R% i% ]: k' N4 @
  2. /*' E4 J" `4 `4 W9 f2 y
  3. * edma_test.c
    8 q5 w% a) b6 J/ |9 }
  4. *
    / s- B) `4 Y: ~
  5. * brief  EDMA3 Test Application
    1 G5 t6 X( v/ N! k
  6. *
    ' @' h: ^8 j( G" \2 w3 E+ f
  7. *   This file contains EDMA3 Test code.
    ( U: K6 c$ S, S; H# R0 M0 J
  8. *
    ; [1 |  h' v2 b/ C  N+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y* H2 j5 O7 f- ]# X* M# K. f, c- N9 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 L, F" M% S' X1 t5 q
  11. *         TO CHANGE.& I8 k  i" `6 ?. A' C
  12. *% a) J' U' d( k/ @7 F2 \6 P& c+ i) `2 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 o% ^( b, ?  Q- [
  14. *! ~+ [- Y- A  ^5 y* r$ p
  15. * This program is free software; you can redistribute it and/or
    4 q( }/ e" v( d
  16. * modify it under the terms of the GNU General Public License as
    4 \) ~% a: B0 e
  17. * published by the Free Software Foundation version 2.
    5 d! Q; |: H! w  F5 @
  18. *
    & e4 f& P" W/ H5 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 p1 y, ~5 X) V  _' A1 g& D
  20. * kind, whether express or implied; without even the implied warranty8 @$ ^+ y0 j" L: U0 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ h4 K# n! [5 o% K1 F2 w
  22. * GNU General Public License for more details.! ~7 R+ f; Q$ Y1 n
  23. */* O2 u8 y& J$ j3 p
  24. 7 n; t0 a2 G0 m" L) f0 |' m
  25. #include <linux/module.h>/ R" L4 t4 K" |5 M: w8 \. F# o
  26. #include <linux/init.h>
    ; c2 e% b- }" Z+ q
  27. #include <linux/errno.h>
    ( P! y* r4 X: y+ s: A0 Z% t
  28. #include <linux/types.h># Z5 R  K/ ]2 v/ r
  29. #include <linux/interrupt.h>
    . R; g0 q' M" T/ ]/ i9 s
  30. #include <asm/io.h>/ l% J5 G% a' q( n, Y
  31. #include <linux/moduleparam.h>
    * w, {% C9 v  C+ {) A
  32. #include <linux/sysctl.h>  Q2 x: \+ j" w& M
  33. #include <linux/mm.h>
    8 V+ s: l# _- @+ K3 `4 _
  34. #include <linux/dma-mapping.h>
    ( J/ |, C, P7 p

  35. ) ?, N: ~1 S6 |! u9 N
  36. #include <mach/memory.h>! j( k5 i- c% s% g$ F* I
  37. #include <mach/hardware.h># G+ e: c6 J; z5 N8 z4 l% W2 u7 z
  38. #include <mach/irqs.h>
    $ I+ X7 i  B- q- }
  39. #include <asm/hardware/edma.h># {8 S3 ^' B" E

  40. ) C- n) X: B+ O5 k0 T" b7 N
  41. #undef EDMA3_DEBUG- z# F# m' R! w4 n9 ]* U& a
  42. /*#define EDMA3_DEBUG*/
    * W; q+ a% p% |) H: x/ Q

  43. 8 h  R3 b& u1 b4 a+ m
  44. #ifdef EDMA3_DEBUG
    $ |: F+ M3 |7 c: ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 C& a, ^( X& E3 U' K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A1 [- |6 V# I5 }7 t% _, @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / G' s+ x7 \+ u& C
  48. #else
    7 m0 P6 J, t% m9 |* N( @7 s; p
  49. #define DMA_PRINTK( x... )) w! Z( V/ l. {( d  F$ [* h9 T  C
  50. #define DMA_FN_IN
    / V+ d0 u; k. ^. ?5 f7 y2 K
  51. #define DMA_FN_OUT
    - ]0 U0 @  Y! _6 [; w# s" H
  52. #endif
    0 U/ ^0 c* i" e
  53. + f+ m3 |) T! D. |$ y  g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 ]7 X. V* k( D1 c+ \  g( U
  55. #define STATIC_SHIFT                3
    - k& K* |; ^* }. L3 v. P2 j. C3 {
  56. #define TCINTEN_SHIFT               201 z/ r& v. D( l: F0 o2 x
  57. #define ITCINTEN_SHIFT              219 \( B5 c2 M/ x" ?
  58. #define TCCHEN_SHIFT                227 w) U6 j/ Z! a$ M
  59. #define ITCCHEN_SHIFT               23
    0 N  a  A$ ^7 k$ _" u

  60. 3 S$ V0 r3 v# Y4 G$ W3 `
  61. static volatile int irqraised1 = 0;" i2 W, V- u/ w7 I( [5 N8 J2 v! ]$ g+ v: o
  62. static volatile int irqraised2 = 0;
    . R3 q- w) b: z# Q1 {8 M+ ~
  63. 8 f7 k& ~+ W; A  r5 {5 [$ w5 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c$ J, p+ j3 V2 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z# G& u7 V% q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 K/ l7 I0 V& z% R
  67. ( I' E0 o. F+ ~7 N8 J' ~
  68. dma_addr_t dmaphyssrc1 = 0;; \" v% D/ k3 D: O- G
  69. dma_addr_t dmaphyssrc2 = 0;
    ( W3 ^2 v. ?6 S. @: |+ o
  70. dma_addr_t dmaphysdest1 = 0;
    3 Y7 E! V. V( Y1 n3 N8 A
  71. dma_addr_t dmaphysdest2 = 0;
    7 K- V% [" s: h5 k. P
  72. % }" m2 m, P' ^# N: r
  73. char *dmabufsrc1 = NULL;& a* }, p; B# N. X
  74. char *dmabufsrc2 = NULL;4 r' o8 J& p7 c
  75. char *dmabufdest1 = NULL;
      x" p* u* p; ^& ?# E! K
  76. char *dmabufdest2 = NULL;: f, E: c$ g2 b- H' p
  77. ( K& U2 `; `# d9 C! |
  78. static int acnt = 512;
    ) a* V4 |. [& L
  79. static int bcnt = 8;7 }+ P. L; J2 R+ y$ ?% Y0 ^
  80. static int ccnt = 8;" |1 \% V* Y& _4 X' D2 q. O

  81. # E8 ]9 @/ B0 t# ^9 \9 p% u
  82. module_param(acnt, int, S_IRUGO);
    % w( W  Y) d6 D* J
  83. module_param(bcnt, int, S_IRUGO);
    3 I6 M+ l6 h  B' _) S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" z& h& X2 ]8 A/ y; B

4 u" l5 P% |) Y) @& g7 K' Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- d: Q2 p$ ]& e+ v, Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ y" r* f* v) k- S3 M, @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Z2 q* P$ y: U  d4 u6 X6 }* M" f0 P

  s" Z- E! B3 Z4 M1 w5 w& |4 {( ]$ y9 K! o! \& L& Y+ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 01:20 , Processed in 0.032570 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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