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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ?1 A  I1 F+ |+ A; S
  1. [code]EDMA sample test application
    , z3 d4 h, }, ]+ c* A
  2. /*/ F$ e, ]6 j: V# A1 T
  3. * edma_test.c
    ) `8 e9 K( l* g. r' ?: s
  4. *
    , D8 E( T: t4 W- K( _' p
  5. * brief  EDMA3 Test Application
    0 {0 U' W3 [7 m. A0 F5 x
  6. *
    6 {' ?+ `, V% d! Y4 h! n6 C
  7. *   This file contains EDMA3 Test code.% I4 ]2 h7 U' \& y) X8 H
  8. *
    / J4 Z- j4 j/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' Q$ Y( N4 j. k, A$ N9 V: d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ~2 |5 s- J3 f9 W& @0 ~9 b
  11. *         TO CHANGE.3 L8 k3 q- w* F+ T+ Y
  12. *
    . G; p8 }. ~5 A/ f8 @" l" S3 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 h/ Z& v- B8 @1 E2 h2 t
  14. *$ E5 }- v! l% e5 b
  15. * This program is free software; you can redistribute it and/or
    ( t6 G5 q% y9 u3 i
  16. * modify it under the terms of the GNU General Public License as( A- D2 a9 e& \: H7 d' J& g
  17. * published by the Free Software Foundation version 2.
    1 s. x% i# H6 o6 _  b9 g/ `
  18. ** y# E6 K) R# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - c* H9 i. T- o* e
  20. * kind, whether express or implied; without even the implied warranty9 M3 ^2 L4 k+ g$ G$ r6 n' `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! Z2 J, x, s' Y1 D- ]
  22. * GNU General Public License for more details.
    , y8 s( \2 A% L( g2 M4 C. ~) }' j2 M
  23. */& W* s; a/ I/ n& d2 g
  24. 4 F" H$ T$ s. z; Y  u
  25. #include <linux/module.h>" K  E( P/ K4 Z
  26. #include <linux/init.h>6 i1 D$ A% t# F5 I; F
  27. #include <linux/errno.h>
    ) @9 @% i% Y: A4 k8 q
  28. #include <linux/types.h>$ {8 m) A" S, U# V+ _1 o, G- k
  29. #include <linux/interrupt.h>
    6 h8 h$ O. @7 {5 b2 ]( Y" v
  30. #include <asm/io.h>- v( _1 e. ~+ u6 S2 Y0 I- q$ X# ^2 s7 \! G
  31. #include <linux/moduleparam.h>9 i* A# U: z9 K6 \
  32. #include <linux/sysctl.h>
    6 {4 B, W9 Z4 W/ c0 R* q; I  u' T; T4 T
  33. #include <linux/mm.h>
    5 o/ f9 |5 Z5 O' c- ^9 Y
  34. #include <linux/dma-mapping.h>& e: ~' ]8 Y; J6 f' Q% E5 T
  35. - v, N! ?" ], s$ p
  36. #include <mach/memory.h>
    / C5 O5 P/ w2 D0 p6 C8 ^( s
  37. #include <mach/hardware.h>5 M& |; e% W; ]# I9 D- P" o
  38. #include <mach/irqs.h>
    ) Z# k) z6 F" x: n
  39. #include <asm/hardware/edma.h>
    0 p2 v) k5 l! `0 p5 [

  40. 1 l7 V. T+ n9 i  _% T' P; i. E8 p9 B% Q  {
  41. #undef EDMA3_DEBUG/ _& l3 }4 F/ W0 s
  42. /*#define EDMA3_DEBUG*/
    5 ~9 n/ C' E+ @+ ~' u

  43. 3 L" y# I1 ]' m$ h% w6 ~4 B" U
  44. #ifdef EDMA3_DEBUG' Z- r3 w% @, Q& _! t3 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Z0 t; g* W+ B+ P2 k4 ^/ y$ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" b8 ^4 `6 Y$ B5 Y! n& q1 x4 n& b( U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) Y# m  T- R% Y5 q* y
  48. #else' C) Y, o+ Z0 [, G. A+ }0 B
  49. #define DMA_PRINTK( x... )& x$ O3 R1 C. L, Q6 \, h7 V- S
  50. #define DMA_FN_IN5 f# a% _8 ?: i
  51. #define DMA_FN_OUT
    * i7 y. V8 b& a
  52. #endif
    + w& j2 J3 D7 ]# C- h8 Z4 m/ J
  53. " d- v% w) r7 m7 ~& F# h0 U4 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + g, p4 }' X  r- r& G
  55. #define STATIC_SHIFT                36 }/ Y6 N8 k- t# o1 F& M
  56. #define TCINTEN_SHIFT               204 G& |, C; c! h8 {( C% H+ Q
  57. #define ITCINTEN_SHIFT              21
    , r. X. {/ B: S8 o4 b# f, t) |
  58. #define TCCHEN_SHIFT                22+ O8 N/ r- O$ N( M" A+ z
  59. #define ITCCHEN_SHIFT               23
    6 `( a  m( F! P7 g4 r8 G

  60. : k) w4 u& R6 H% }) e+ A
  61. static volatile int irqraised1 = 0;
    4 E, A( `. v2 f9 q
  62. static volatile int irqraised2 = 0;
    " T. c, ^9 i  _9 m' C* D. _* E( H2 q9 G
  63. 8 _/ ]6 N2 ^  M3 n% N' U* k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . c6 P+ E. L1 e: M/ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 D& ]6 y% `2 Z5 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 L' t5 v  j/ V2 D( s: |0 f5 T

  67. ) F; S+ G( r+ I5 \3 s; Z6 K
  68. dma_addr_t dmaphyssrc1 = 0;
    9 Y7 e' b, g% v7 E, W
  69. dma_addr_t dmaphyssrc2 = 0;
    : m4 k/ j, m, ]; X8 [
  70. dma_addr_t dmaphysdest1 = 0;/ ?8 W" ]1 {: [' Q
  71. dma_addr_t dmaphysdest2 = 0;7 U- _6 M" V: O* i5 D$ k3 o# s
  72. & J# v; a* @& A' V+ {5 a% }
  73. char *dmabufsrc1 = NULL;, {" m! `1 j8 l8 ?! N
  74. char *dmabufsrc2 = NULL;
    - w+ n. X" ^: u8 j
  75. char *dmabufdest1 = NULL;
    $ M5 K4 E- ]7 q7 X0 u% Z
  76. char *dmabufdest2 = NULL;+ z( Q+ j, T1 M' P/ |; w
  77. ! N- r$ A  R' e) y
  78. static int acnt = 512;0 W' T+ m. O! P  j
  79. static int bcnt = 8;
    ( ?, Y; s- o, n3 I
  80. static int ccnt = 8;
    9 a4 D4 m& Y& ^. A( D6 ~, U0 ?' F

  81. - t$ v& Z, Z$ p0 K$ d, w
  82. module_param(acnt, int, S_IRUGO);
    5 m+ t) w/ H3 ~4 V8 s
  83. module_param(bcnt, int, S_IRUGO);% d+ S0 r( k5 l% r+ o+ v( U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 Q  c, p3 T% S+ ~  y! F
! F) M# I4 h4 g- @/ Q% a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `( {' O' p3 E; W& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G" A$ q4 l. M; }( Q* q. j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 f3 T  x) G- d$ [) F' n3 B# k6 k5 P( G- m4 S$ F+ J
) l+ p" X' w3 d' }+ e- O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 08:25 , Processed in 0.040244 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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